mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
prevent generator finalization from invalidating sys.exc_info() #7173
This commit is contained in:
parent
0e4c22c922
commit
ae5f2f4a39
3 changed files with 19 additions and 2 deletions
|
@ -1159,7 +1159,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
assert(stack_pointer != NULL);
|
||||
f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */
|
||||
|
||||
if (f->f_code->co_flags & CO_GENERATOR) {
|
||||
if (co->co_flags & CO_GENERATOR && !throwflag) {
|
||||
if (f->f_exc_type != NULL && f->f_exc_type != Py_None) {
|
||||
/* We were in an except handler when we left,
|
||||
restore the exception state which was put aside
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue