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 <rep...@bugs.python.org> <http://bugs.python.org/issue25612> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com