summaryrefslogtreecommitdiffstats
path: root/Include
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 /Include
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 'Include')
-rw-r--r--Include/cpython/abstract.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index be37e19..fef538e 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -49,6 +49,7 @@ PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(
or _PyObject_FastCallDict() (both forms are supported),
except that nargs is plainly the number of arguments without flags. */
PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall(
+ PyThreadState *tstate,
PyObject *callable,
PyObject *const *args, Py_ssize_t nargs,
PyObject *keywords);
@@ -95,22 +96,31 @@ _PyVectorcall_Function(PyObject *callable)
Return the result on success. Raise an exception and return NULL on
error. */
static inline PyObject *
-_PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
- size_t nargsf, PyObject *kwnames)
+_PyObject_VectorcallTstate(PyThreadState *tstate, PyObject *callable,
+ PyObject *const *args, size_t nargsf,
+ PyObject *kwnames)
{
assert(kwnames == NULL || PyTuple_Check(kwnames));
assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0);
- PyThreadState *tstate = PyThreadState_GET();
vectorcallfunc func = _PyVectorcall_Function(callable);
if (func == NULL) {
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
- return _PyObject_MakeTpCall(callable, args, nargs, kwnames);
+ return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwnames);
}
PyObject *res = func(callable, args, nargsf, kwnames);
return _Py_CheckFunctionResult(tstate, callable, res, NULL);
}
+static inline PyObject *
+_PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
+ size_t nargsf, PyObject *kwnames)
+{
+ PyThreadState *tstate = PyThreadState_GET();
+ return _PyObject_VectorcallTstate(tstate, callable,
+ args, nargsf, kwnames);
+}
+
/* Same as _PyObject_Vectorcall except that keyword arguments are passed as
dict, which may be NULL if there are no keyword arguments. */
PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(