mirror of
https://github.com/python/cpython.git
synced 2025-09-04 16:01:10 +00:00
Issue 3611: in some cases (a __del__ re-raising an exception, when called from inside
an 'except' clause), the exception __context__ would be reset to None. This crases the interpreter if this precisely happens inside PyErr_SetObject. - now the __context__ is properly preserved - in any case, PyErr_SetObject now saves the current exc_value in a local variable, to avoid such crashes in the future. Reviewer: Antoine Pitrou.
This commit is contained in:
parent
4f3c5616cc
commit
db26f7c137
4 changed files with 36 additions and 10 deletions
|
@ -2453,11 +2453,6 @@ fast_block_end:
|
|||
|
||||
if (b->b_type == EXCEPT_HANDLER) {
|
||||
UNWIND_EXCEPT_HANDLER(b);
|
||||
if (why == WHY_EXCEPTION && !throwflag) {
|
||||
Py_CLEAR(tstate->exc_type);
|
||||
Py_CLEAR(tstate->exc_value);
|
||||
Py_CLEAR(tstate->exc_traceback);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
UNWIND_BLOCK(b);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue