diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-05 21:26:40 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-05 21:26:40 (GMT) |
commit | 58720d6145eca69b9aa45b720cb3c1376b1ddaea (patch) | |
tree | 56a90729aff1127491b8f895b40b4159ca3dce56 /Include | |
parent | c53204b9477a2e28b6b366fd271f61c73b805cee (diff) | |
download | cpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.zip cpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.tar.gz cpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.tar.bz2 |
Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/frameobject.h | 3 | ||||
-rw-r--r-- | Include/genobject.h | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Include/frameobject.h b/Include/frameobject.h index 33f73af..10ba06f 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -36,6 +36,8 @@ typedef struct _frame { non-generator frames. See the save_exc_state and swap_exc_state functions in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; + /* Borrowed referenced to a generator, or NULL */ + PyObject *f_gen; PyThreadState *f_tstate; int f_lasti; /* Last instruction if called */ @@ -46,6 +48,7 @@ typedef struct _frame { bytecode index. */ int f_lineno; /* Current line number */ int f_iblock; /* index in f_blockstack */ + char f_executing; /* whether the frame is still executing */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ } PyFrameObject; diff --git a/Include/genobject.h b/Include/genobject.h index ed451ba..65f1ecf 100644 --- a/Include/genobject.h +++ b/Include/genobject.h @@ -36,6 +36,8 @@ PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); PyObject *_PyGen_Send(PyGenObject *, PyObject *); +PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); + #ifdef __cplusplus } |