Regression in 5.1.0 - decorator.contextmanager no longer compat with contextlib.contextmanager
wimglenn opened this issue · 4 comments
wimglenn commented
The docs give this example of decorator.contextmanager
as a drop-in replacement ("usage is identical") for contextlib.contextmanager
:
from decorator import contextmanager
@contextmanager
def before_after(before, after):
print(before)
yield
print(after)
ba = before_after('BEFORE', 'AFTER')
@ba
def hello():
print('hello')
hello()
Expected output (correct in decorator < 5.1.0
, and same in stdlib contextmanager):
BEFORE
hello
AFTER
Actual output in 5.1.0:
('BEFORE', 'AFTER')
hello
{}
Don't see any API change mentioned in the changelog so I think this may be a regression introduced in fixing #130
micheles commented
You are right, that fix caused the regression. Thanks for pointing this out.
micheles commented
I am going to publish release 5.1.1 today.