diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-06-28 09:49:00 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-06-28 09:49:00 (GMT) |
commit | b1263d5a60d3f7ab02dd28409fff59b3815a3f67 (patch) | |
tree | d2b48c8ffcf6b8d4c042495e0b8888b7deda086e /Include/cpython | |
parent | b4bee03087a3c70cb040e2ce569c828860ed8e87 (diff) | |
download | cpython-b1263d5a60d3f7ab02dd28409fff59b3815a3f67.zip cpython-b1263d5a60d3f7ab02dd28409fff59b3815a3f67.tar.gz cpython-b1263d5a60d3f7ab02dd28409fff59b3815a3f67.tar.bz2 |
bpo-37337: Add _PyObject_VectorcallMethod() (GH-14228)
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/abstract.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index 415f3e1..b4288e7 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -158,6 +158,10 @@ PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( PyObject *args, PyObject *kwargs); +PyAPI_FUNC(PyObject *) _PyObject_VectorcallMethod( + PyObject *name, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + /* Like PyObject_CallMethod(), but expect a _Py_Identifier* as the method name. */ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, @@ -174,6 +178,18 @@ PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( struct _Py_Identifier *name, ...); +static inline PyObject * +_PyObject_VectorcallMethodId( + _Py_Identifier *name, PyObject *const *args, + size_t nargsf, PyObject *kwnames) +{ + PyObject *oname = _PyUnicode_FromId(name); /* borrowed */ + if (!oname) { + return NULL; + } + return _PyObject_VectorcallMethod(oname, args, nargsf, kwnames); +} + PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); /* Guess the size of object 'o' using len(o) or o.__length_hint__(). |