diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-07-08 08:19:25 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-07-08 08:19:25 (GMT) |
commit | 762f93ff2efd6b7ef0177cad57939c0ab2002eac (patch) | |
tree | 4811b08fa9342c3b2575de7e7c1030d1d5eea8a0 /Include | |
parent | 38f44b4a4adc37e8f5f8971917d8b3145f351a56 (diff) | |
download | cpython-762f93ff2efd6b7ef0177cad57939c0ab2002eac.zip cpython-762f93ff2efd6b7ef0177cad57939c0ab2002eac.tar.gz cpython-762f93ff2efd6b7ef0177cad57939c0ab2002eac.tar.bz2 |
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/abstract.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index c9a8a07..e9a2319 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -156,6 +156,13 @@ PyAPI_FUNC(PyObject *) _PyObject_VectorcallMethod( PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static inline PyObject * +_PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) +{ + return _PyObject_VectorcallMethod(name, &self, + 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +} + /* Like PyObject_CallMethod(), but expect a _Py_Identifier* as the method name. */ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, @@ -184,6 +191,13 @@ _PyObject_VectorcallMethodId( return _PyObject_VectorcallMethod(oname, args, nargsf, kwnames); } +static inline PyObject * +_PyObject_CallMethodIdNoArgs(PyObject *self, _Py_Identifier *name) +{ + return _PyObject_VectorcallMethodId(name, &self, + 1 | 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__(). |