mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-44590: Lazily allocate frame objects (GH-27077)
* Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it. * Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector. * Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation. * Move ownership of InterpreterFrame in generator from frame object to generator object. * Do not create frame objects for Python calls. * Do not create frame objects for generators.
This commit is contained in:
parent
0363a4014d
commit
ae0a2b7562
27 changed files with 1037 additions and 619 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "Python.h"
|
||||
#include "frameobject.h"
|
||||
#include "pycore_frame.h"
|
||||
#include "interpreteridobject.h"
|
||||
|
||||
|
||||
|
@ -1834,13 +1835,12 @@ _is_running(PyInterpreterState *interp)
|
|||
}
|
||||
|
||||
assert(!PyErr_Occurred());
|
||||
PyFrameObject *frame = PyThreadState_GetFrame(tstate);
|
||||
InterpreterFrame *frame = tstate->frame;
|
||||
if (frame == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int executing = _PyFrame_IsExecuting(frame);
|
||||
Py_DECREF(frame);
|
||||
|
||||
return executing;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue