diff options
author | Mark Shannon <mark@hotpy.org> | 2021-11-23 09:53:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 09:53:24 (GMT) |
commit | 135cabd328504e1648d17242b42b675cdbd0193b (patch) | |
tree | 4efa5418b1816ba02c206678ecfa4e2d8e8d8f14 /Python/pystate.c | |
parent | d82f2caf942fa8b94e797a2f116ee54ec303c2df (diff) | |
download | cpython-135cabd328504e1648d17242b42b675cdbd0193b.zip cpython-135cabd328504e1648d17242b42b675cdbd0193b.tar.gz cpython-135cabd328504e1648d17242b42b675cdbd0193b.tar.bz2 |
bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595)
* Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead.
* Add reference to function to frame, borrow references to builtins and globals.
* Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 273982b..56db095d 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -2087,9 +2087,9 @@ _PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size) InterpreterFrame * -_PyThreadState_PushFrame(PyThreadState *tstate, PyFrameConstructor *con, PyObject *locals) +_PyThreadState_PushFrame(PyThreadState *tstate, PyFunctionObject *func, PyObject *locals) { - PyCodeObject *code = (PyCodeObject *)con->fc_code; + PyCodeObject *code = (PyCodeObject *)func->func_code; int nlocalsplus = code->co_nlocalsplus; size_t size = nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE; @@ -2097,7 +2097,7 @@ _PyThreadState_PushFrame(PyThreadState *tstate, PyFrameConstructor *con, PyObjec if (frame == NULL) { return NULL; } - _PyFrame_InitializeSpecials(frame, con, locals, nlocalsplus); + _PyFrame_InitializeSpecials(frame, func, locals, nlocalsplus); for (int i=0; i < nlocalsplus; i++) { frame->localsplus[i] = NULL; } |