mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
This commit is contained in:
parent
c53204b947
commit
58720d6145
10 changed files with 80 additions and 10 deletions
|
@ -1182,6 +1182,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
stack_pointer = f->f_stacktop;
|
||||
assert(stack_pointer != NULL);
|
||||
f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */
|
||||
f->f_executing = 1;
|
||||
|
||||
if (co->co_flags & CO_GENERATOR && !throwflag) {
|
||||
if (f->f_exc_type != NULL && f->f_exc_type != Py_None) {
|
||||
|
@ -3206,6 +3207,7 @@ fast_yield:
|
|||
/* pop frame */
|
||||
exit_eval_frame:
|
||||
Py_LeaveRecursiveCall();
|
||||
f->f_executing = 0;
|
||||
tstate->frame = f->f_back;
|
||||
|
||||
return retval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue