import contextlib
@contextlib.contextmanager
def test():
yield
with test():
raise Exception
produces the following traceback:
Traceback (most recent call last):
File "...\contextlib.py", line 77, in __exit__
File "<stdin>", line 3, in test
Exception
instead of the expected:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
Exception