From 135cabd328504e1648d17242b42b675cdbd0193b Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Tue, 23 Nov 2021 09:53:24 +0000 Subject: 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. --- Python/bltinmodule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 9e3b25c59a..6763f99697 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -212,9 +212,8 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs, Py_TYPE(ns)->tp_name); goto error; } - PyFrameConstructor *f = PyFunction_AS_FRAME_CONSTRUCTOR(func); PyThreadState *tstate = _PyThreadState_GET(); - cell = _PyEval_Vector(tstate, f, ns, NULL, 0, NULL); + cell = _PyEval_Vector(tstate, (PyFunctionObject *)func, ns, NULL, 0, NULL); if (cell != NULL) { if (bases != orig_bases) { if (PyMapping_SetItemString(ns, "__orig_bases__", orig_bases) < 0) { -- cgit v1.2.1