[issue23556] Scope for raise without argument is different in Python 2 and 3

Martin Panter report at bugs.python.org
Sun Mar 8 02:49:13 CET 2015


Martin Panter added the comment:

For the Python 3 case, the documentation is vague and probably wrong, depending on what you understand “the current scope” to mean. I think it should read something like

. . . raise re-raises the current exception that is being handled. If no exception is being handled, a RuntimeError exception is raised indicating that this is an error.

I’m not sure but I suspect Python 2 is different because does not save the original exception when it handles a nested exception. In other words, at the point where the nested “bar” exception is raised inside the “foo” handler, Python forgets that “foo” was being handled.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23556>
_______________________________________


More information about the Python-bugs-list mailing list