diff options
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/abstract.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index e9a2319..d57aa54 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -163,6 +163,15 @@ _PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); } +static inline PyObject * +_PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg) +{ + assert(arg != NULL); + PyObject *args[2] = {self, arg}; + return _PyObject_VectorcallMethod(name, args, + 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +} + /* Like PyObject_CallMethod(), but expect a _Py_Identifier* as the method name. */ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, @@ -198,6 +207,15 @@ _PyObject_CallMethodIdNoArgs(PyObject *self, _Py_Identifier *name) 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); } +static inline PyObject * +_PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg) +{ + assert(arg != NULL); + PyObject *args[2] = {self, arg}; + return _PyObject_VectorcallMethodId(name, args, + 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +} + PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); /* Guess the size of object 'o' using len(o) or o.__length_hint__(). |