comparison Python/ceval.c @ 48887:c562c8dae49a

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.
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Fri, 29 Aug 2008 07:13:32 +0000
parents 013d4d8407cb
children 22ab106e3186
comparison
equal deleted inserted replaced
48886:6ceb7c89e776 48887:c562c8dae49a
2451 break; 2451 break;
2452 } 2452 }
2453 2453
2454 if (b->b_type == EXCEPT_HANDLER) { 2454 if (b->b_type == EXCEPT_HANDLER) {
2455 UNWIND_EXCEPT_HANDLER(b); 2455 UNWIND_EXCEPT_HANDLER(b);
2456 if (why == WHY_EXCEPTION && !throwflag) {
2457 Py_CLEAR(tstate->exc_type);
2458 Py_CLEAR(tstate->exc_value);
2459 Py_CLEAR(tstate->exc_traceback);
2460 }
2461 continue; 2456 continue;
2462 } 2457 }
2463 UNWIND_BLOCK(b); 2458 UNWIND_BLOCK(b);
2464 if (b->b_type == SETUP_LOOP && why == WHY_BREAK) { 2459 if (b->b_type == SETUP_LOOP && why == WHY_BREAK) {
2465 why = WHY_NOT; 2460 why = WHY_NOT;