From 4d231bcc77ac8ce7d11bda0804130dcdd678f710 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 14 Nov 2019 13:36:21 +0100 Subject: bpo-38644: Add _PyObject_Call() (GH-17089) * Add pycore_call.h internal header file. * Add _PyObject_Call(): PyObject_Call() with tstate * Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate * Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict() with tstate * _PyObject_Call_Prepend() now takes tstate * Replace _PyObject_FastCall() calls with _PyObject_VectorcallTstate() calls --- Include/cpython/abstract.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'Include/cpython') diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index fef538e63e..2c4eae70b9 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -137,7 +137,8 @@ PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, Py static inline PyObject * _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs) { - return _PyObject_Vectorcall(func, args, (size_t)nargs, NULL); + PyThreadState *tstate = PyThreadState_GET(); + return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL); } /* Call a callable without any arguments @@ -145,7 +146,8 @@ _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs) PyObject_CallNoArgs(). */ static inline PyObject * _PyObject_CallNoArg(PyObject *func) { - return _PyObject_Vectorcall(func, NULL, 0, NULL); + PyThreadState *tstate = PyThreadState_GET(); + return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL); } static inline PyObject * @@ -155,16 +157,11 @@ _PyObject_CallOneArg(PyObject *func, PyObject *arg) PyObject *_args[2]; PyObject **args = _args + 1; // For PY_VECTORCALL_ARGUMENTS_OFFSET args[0] = arg; - return _PyObject_Vectorcall(func, args, - 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); + PyThreadState *tstate = PyThreadState_GET(); + size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; + return _PyObject_VectorcallTstate(tstate, func, args, nargsf, NULL); } -PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( - PyObject *callable, - PyObject *obj, - PyObject *args, - PyObject *kwargs); - PyAPI_FUNC(PyObject *) _PyObject_VectorcallMethod( PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); -- cgit v1.2.1