mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
gh-118272: Clear generator frame's locals when the generator is closed (#118277)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This commit is contained in:
parent
f7747f73a9
commit
1f16b4ce56
5 changed files with 38 additions and 5 deletions
|
@ -380,6 +380,7 @@ gen_close(PyGenObject *gen, PyObject *args)
|
|||
// RESUME after YIELD_VALUE and exception depth is 1
|
||||
assert((oparg & RESUME_OPARG_LOCATION_MASK) != RESUME_AT_FUNC_START);
|
||||
gen->gi_frame_state = FRAME_COMPLETED;
|
||||
_PyFrame_ClearLocals((_PyInterpreterFrame *)gen->gi_iframe);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue