mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
This commit is contained in:
parent
2a3d4d9c53
commit
59ad110d7a
23 changed files with 104 additions and 93 deletions
|
@ -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__().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue