mirror of
https://github.com/python/cpython.git
synced 2025-07-27 13:14:41 +00:00
SF Patch #1463867: Improved generator finalization to allow generators
that are suspended outside of any try/except/finally blocks to be garbage collected even if they are part of a cycle. Generators that suspend inside of an active try/except or try/finally block (including those created by a ``with`` statement) are still not GC-able if they are part of a cycle, however.
This commit is contained in:
parent
17de8ffc21
commit
2ba96610bf
4 changed files with 29 additions and 1 deletions
|
@ -2179,6 +2179,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throw)
|
|||
case SETUP_LOOP:
|
||||
case SETUP_EXCEPT:
|
||||
case SETUP_FINALLY:
|
||||
/* NOTE: If you add any new block-setup opcodes that are not try/except/finally
|
||||
handlers, you may need to update the PyGen_NeedsFinalizing() function. */
|
||||
|
||||
PyFrame_BlockSetup(f, opcode, INSTR_OFFSET() + oparg,
|
||||
STACK_LEVEL());
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue