Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 46725:acd68277c4dd
Antoine Pitrou's patch for bug 2507; exception state lives too long in
3.0.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Thu, 08 May 2008 04:26:35 +0000 |
| parents | 832c820e9d14 |
| children | 23ab586c427a |
line wrap: on
line diff
--- a/Python/ceval.c Thu May 08 01:45:31 2008 +0000 +++ b/Python/ceval.c Thu May 08 04:26:35 2008 +0000 @@ -1477,6 +1477,19 @@ "'finally' pops bad exception"); why = WHY_EXCEPTION; } + /* + Make sure the exception state is cleaned up before + the end of an except block. This ensures objects + referenced by the exception state are not kept + alive too long. + See #2507. + */ + if (tstate->frame->f_exc_type != NULL) + reset_exc_info(tstate); + else { + assert(tstate->frame->f_exc_value == NULL); + assert(tstate->frame->f_exc_traceback == NULL); + } Py_DECREF(v); break;
