This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients SilentGhost, a3nm, collinwinter, docs@python, martin.panter
Date 2015-07-29.09:28:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438162096.47.0.697321227766.issue23556@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-07-29 09:28:16martin.pantersetrecipients: + martin.panter, collinwinter, SilentGhost, docs@python, a3nm
2015-07-29 09:28:16martin.pantersetmessageid: <1438162096.47.0.697321227766.issue23556@psf.upfronthosting.co.za>
2015-07-29 09:28:16martin.panterlinkissue23556 messages
2015-07-29 09:28:15martin.pantercreate