[New-bugs-announce] [issue25612] nested try..excepts don't work correctly for generators
Yury Selivanov
report at bugs.python.org
Thu Nov 12 15:59:19 EST 2015
New submission from Yury Selivanov:
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
----------
components: Interpreter Core
messages: 254557
nosy: benjamin.peterson, gvanrossum, haypo, larry, ncoghlan, yselivanov
priority: release blocker
severity: normal
status: open
title: nested try..excepts don't work correctly for generators
versions: Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25612>
_______________________________________
More information about the New-bugs-announce
mailing list