Message28008
Given:
@contextmanager
def gen():
print '__enter__'
try:
yield
finally:
print '__exit__'
with gen():
raise StopIteration('body')
running the above results in:
__enter__
__exit__
I would have expected instead
__enter__
__exit__
Traceback (most recent call last):
File "test25.py", line 53, in <module>
raise StopIteration('body')
StopIteration: body
Note that doing:
with gen():
raise GeneratorExit('body')
does the expected thing:
__enter__
__exit__
Traceback (most recent call last):
File "test25.py", line 53, in <module>
raise GeneratorExit('body')
GeneratorExit: body |
|
Date |
User |
Action |
Args |
2007-08-23 14:39:02 | admin | link | issue1462485 messages |
2007-08-23 14:39:02 | admin | create | |
|