diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-16 00:03:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-16 00:03:22 (GMT) |
commit | b5e170f127b57d5b0a4fb58f316acd6191509dce (patch) | |
tree | cb63be7c4be29eb144c748ec1dfa1fb7e05c4974 /Python/ceval.c | |
parent | 0fe0b88d6eb597c9a929e14ad47a5a9bd99bfe53 (diff) | |
download | cpython-b5e170f127b57d5b0a4fb58f316acd6191509dce.zip cpython-b5e170f127b57d5b0a4fb58f316acd6191509dce.tar.gz cpython-b5e170f127b57d5b0a4fb58f316acd6191509dce.tar.bz2 |
bpo-38644: Add _PyEval_EvalCode() (GH-17183)
_PyFunction_Vectorcall() now pass tstate to function calls.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 11d25a5..9f4b436 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4045,7 +4045,8 @@ fail: the test in the if statements in Misc/gdbinit (pystack and pystackv). */ PyObject * -_PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, +_PyEval_EvalCode(PyThreadState *tstate, + PyObject *_co, PyObject *globals, PyObject *locals, PyObject *const *args, Py_ssize_t argcount, PyObject *const *kwnames, PyObject *const *kwargs, Py_ssize_t kwcount, int kwstep, @@ -4053,6 +4054,8 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, PyObject *kwdefs, PyObject *closure, PyObject *name, PyObject *qualname) { + assert(tstate != NULL); + PyCodeObject* co = (PyCodeObject*)_co; PyFrameObject *f; PyObject *retval = NULL; @@ -4062,9 +4065,6 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, Py_ssize_t i, j, n; PyObject *kwdict; - PyThreadState *tstate = _PyThreadState_GET(); - assert(tstate != NULL); - if (globals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, "PyEval_EvalCodeEx: NULL globals"); @@ -4319,6 +4319,26 @@ fail: /* Jump here from prelude on failure */ return retval; } + +PyObject * +_PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, + PyObject *const *args, Py_ssize_t argcount, + PyObject *const *kwnames, PyObject *const *kwargs, + Py_ssize_t kwcount, int kwstep, + PyObject *const *defs, Py_ssize_t defcount, + PyObject *kwdefs, PyObject *closure, + PyObject *name, PyObject *qualname) +{ + PyThreadState *tstate = _PyThreadState_GET(); + return _PyEval_EvalCode(tstate, _co, globals, locals, + args, argcount, + kwnames, kwargs, + kwcount, kwstep, + defs, defcount, + kwdefs, closure, + name, qualname); +} + PyObject * PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals, PyObject *const *args, int argcount, |