Message247563
| 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:16 | martin.panter | set | recipients:
+ martin.panter, collinwinter, SilentGhost, docs@python, a3nm |
| 2015年07月29日 09:28:16 | martin.panter | set | messageid: <1438162096.47.0.697321227766.issue23556@psf.upfronthosting.co.za> |
| 2015年07月29日 09:28:16 | martin.panter | link | issue23556 messages |
| 2015年07月29日 09:28:15 | martin.panter | create |
|