summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorJeroen Demeyer <J.Demeyer@UGent.be>2019-07-11 08:59:05 (GMT)
committerInada Naoki <songofacandy@gmail.com>2019-07-11 08:59:05 (GMT)
commit59ad110d7a7784d53d0b502eebce0346597a6bef (patch)
tree8ccd39e358017efe2abe41912c2f9d567ee9f248 /Include
parent2a3d4d9c53dd4831c3ecf56bc7c4a289c33030d6 (diff)
downloadcpython-59ad110d7a7784d53d0b502eebce0346597a6bef.zip
cpython-59ad110d7a7784d53d0b502eebce0346597a6bef.tar.gz
cpython-59ad110d7a7784d53d0b502eebce0346597a6bef.tar.bz2
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/abstract.h18
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__().