summaryrefslogtreecommitdiffstats
path: root/Objects/call.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-11-08 09:05:17 (GMT)
committerGitHub <noreply@github.com>2019-11-08 09:05:17 (GMT)
commit7e433733175e76627d46ed9bdab543860cd1452d (patch)
treeab96312f08fbd190262d5cdc628be5958948ad81 /Objects/call.c
parentbefa032d8869e0fab4732d910f3887642879d644 (diff)
downloadcpython-7e433733175e76627d46ed9bdab543860cd1452d.zip
cpython-7e433733175e76627d46ed9bdab543860cd1452d.tar.gz
cpython-7e433733175e76627d46ed9bdab543860cd1452d.tar.bz2
bpo-38644: Add _PyObject_VectorcallTstate() (GH-17052)
* Add _PyObject_VectorcallTstate() function: similar to _PyObject_Vectorcall(), but with tstate parameter * Add tstate parameter to _PyObject_MakeTpCall()
Diffstat (limited to 'Objects/call.c')
-rw-r--r--Objects/call.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Objects/call.c b/Objects/call.c
index a1d0b33..a8ae41a 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -104,7 +104,7 @@ _PyObject_FastCallDict(PyObject *callable, PyObject *const *args,
vectorcallfunc func = _PyVectorcall_Function(callable);
if (func == NULL) {
/* Use tp_call instead */
- return _PyObject_MakeTpCall(callable, args, nargs, kwargs);
+ return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwargs);
}
PyObject *res;
@@ -129,10 +129,10 @@ _PyObject_FastCallDict(PyObject *callable, PyObject *const *args,
PyObject *
-_PyObject_MakeTpCall(PyObject *callable, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords)
+_PyObject_MakeTpCall(PyThreadState *tstate, PyObject *callable,
+ PyObject *const *args, Py_ssize_t nargs,
+ PyObject *keywords)
{
- PyThreadState *tstate = _PyThreadState_GET();
-
/* Slow path: build a temporary tuple for positional arguments and a
* temporary dictionary for keyword arguments (if any) */
ternaryfunc call = Py_TYPE(callable)->tp_call;
@@ -774,6 +774,7 @@ _PyObject_VectorcallMethod(PyObject *name, PyObject *const *args,
assert(args != NULL);
assert(PyVectorcall_NARGS(nargsf) >= 1);
+ PyThreadState *tstate = _PyThreadState_GET();
PyObject *callable = NULL;
/* Use args[0] as "self" argument */
int unbound = _PyObject_GetMethod(args[0], name, &callable);
@@ -792,7 +793,8 @@ _PyObject_VectorcallMethod(PyObject *name, PyObject *const *args,
args++;
nargsf--;
}
- PyObject *result = _PyObject_Vectorcall(callable, args, nargsf, kwnames);
+ PyObject *result = _PyObject_VectorcallTstate(tstate, callable,
+ args, nargsf, kwnames);
Py_DECREF(callable);
return result;
}