summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/decorator.py4
-rw-r--r--src/tests/documentation.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/decorator.py b/src/decorator.py
index dab0d7c..9435841 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -294,11 +294,11 @@ def decorator(caller, _func=None, kwsyntax=False):
class ContextManager(_GeneratorContextManager):
def __init__(self, g, *a, **k):
- return _GeneratorContextManager.__init__(self, g, a, k)
+ _GeneratorContextManager.__init__(self, g, a, k)
def __call__(self, func):
def caller(f, *a, **k):
- with self:
+ with self._recreate_cm():
return f(*a, **k)
return decorate(func, caller)
diff --git a/src/tests/documentation.py b/src/tests/documentation.py
index 4fa5c9d..5323c4e 100644
--- a/src/tests/documentation.py
+++ b/src/tests/documentation.py
@@ -599,11 +599,11 @@ a ``__call__`` method, so that they can be used as decorators, like so:
```python
>>> ba = before_after('BEFORE', 'AFTER')
>>>
->>> @ba # doctest: +SKIP
+>>> @ba
... def hello():
... print('hello')
...
->>> hello() # doctest: +SKIP
+>>> hello()
BEFORE
hello
AFTER