Message254557
Nested try..except statements with yields can loose reference to the current exception.
The following code:
class MainError(Exception):
pass
class SubError(Exception):
pass
def main():
try:
raise MainError()
except MainError:
try:
yield
except SubError:
print('got SubError')
raise
coro = main()
coro.send(None)
coro.throw(SubError())
prints:
got SubError
Traceback (most recent call last):
File "t.py", line 19, in <module>
coro.throw(SubError())
File "t.py", line 15, in main
raise
RuntimeError: No active exception to reraise |
|
Date |
User |
Action |
Args |
2015-11-12 20:59:19 | yselivanov | set | recipients:
+ yselivanov, gvanrossum, ncoghlan, vstinner, larry, benjamin.peterson |
2015-11-12 20:59:19 | yselivanov | set | messageid: <1447361959.0.0.839122121456.issue25612@psf.upfronthosting.co.za> |
2015-11-12 20:59:18 | yselivanov | link | issue25612 messages |
2015-11-12 20:59:18 | yselivanov | create | |
|