From 0332e569c12d3dc97171546c6dc10e42c27de34b Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 1 Feb 2021 10:42:03 +0000 Subject: bpo-42990: Further refactoring of PyEval_ functions. (GH-24368) * Further refactoring of PyEval_EvalCode and friends. Break into make-frame, and eval-frame parts. * Simplify function vector call using new _PyEval_Vector. * Remove unused internal functions: _PyEval_EvalCodeWithName and _PyEval_EvalCode. * Don't use legacy function PyEval_EvalCodeEx. --- Python/bltinmodule.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 352fb83d55..8c4e6e5107 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -8,6 +8,7 @@ #include "pycore_pyerrors.h" // _PyErr_NoMemory() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_FromArray() +#include "pycore_ceval.h" // _PyEval_Vector() _Py_IDENTIFIER(__builtins__); _Py_IDENTIFIER(__dict__); @@ -219,9 +220,9 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs, Py_TYPE(ns)->tp_name); goto error; } - cell = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, - NULL, 0, NULL, 0, NULL, 0, NULL, - PyFunction_GET_CLOSURE(func)); + PyFrameConstructor *f = PyFunction_AS_FRAME_CONSTRUCTOR(func); + PyThreadState *tstate = PyThreadState_GET(); + cell = _PyEval_Vector(tstate, f, ns, NULL, 0, NULL); if (cell != NULL) { if (bases != orig_bases) { if (PyMapping_SetItemString(ns, "__orig_bases__", orig_bases) < 0) { -- cgit v1.2.1