[docs] [issue23556] Scope for raise without argument is different in Python 2 and 3
Martin Panter
report at bugs.python.org
Wed Jul 29 11:28:16 CEST 2015
Martin Panter added the comment:
Here is a patch for Python 3. The re-raise behaviour reported by Antoine is already tested in test_raise.TestRaise.test_except_reraise().
My patch also clarifies some details about how __context__ is set:
* Context is the exception being handled, not necessarily the last exception
* “With” statements can influence context
* Re-raising does not set context; must be new exception object
* Add test case when context is not the last exception
I’m not so experienced with Python 2’s exception handling, so I haven’t got a patch for that. I suspect there is some shared “last exception” context. I wonder how it interacts with generators, multi-threading, __del__() and other callbacks, etc.
----------
keywords: +patch
stage: -> patch review
versions: +Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40053/raise-scope-py3.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23556>
_______________________________________
More information about the docs
mailing list