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/frame.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/frame.c')
-rw-r--r-- | Python/frame.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/frame.c b/Python/frame.c index a5c93ea..79b0f77 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -8,9 +8,8 @@ int _PyFrame_Traverse(InterpreterFrame *frame, visitproc visit, void *arg) { Py_VISIT(frame->frame_obj); - Py_VISIT(frame->f_globals); - Py_VISIT(frame->f_builtins); Py_VISIT(frame->f_locals); + Py_VISIT(frame->f_func); Py_VISIT(frame->f_code); /* locals */ PyObject **locals = _PyFrame_GetLocalsArray(frame); @@ -62,8 +61,7 @@ clear_specials(InterpreterFrame *frame) frame->generator = NULL; Py_XDECREF(frame->frame_obj); Py_XDECREF(frame->f_locals); - Py_DECREF(frame->f_globals); - Py_DECREF(frame->f_builtins); + Py_DECREF(frame->f_func); Py_DECREF(frame->f_code); } |