diff options
Diffstat (limited to 'Objects/call.c')
-rw-r--r-- | Objects/call.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Objects/call.c b/Objects/call.c index 310a2d7..c3939ea 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -607,7 +607,6 @@ callmethod(PyThreadState *tstate, PyObject* callable, const char *format, va_lis return _PyObject_CallFunctionVa(tstate, callable, format, va, is_size_t); } - PyObject * PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) { @@ -659,6 +658,30 @@ PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) PyObject * +_PyObject_CallMethod(PyObject *obj, PyObject *name, + const char *format, ...) +{ + PyThreadState *tstate = _PyThreadState_GET(); + if (obj == NULL || name == NULL) { + return null_error(tstate); + } + + PyObject *callable = PyObject_GetAttr(obj, name); + if (callable == NULL) { + return NULL; + } + + va_list va; + va_start(va, format); + PyObject *retval = callmethod(tstate, callable, format, va, 1); + va_end(va); + + Py_DECREF(callable); + return retval; +} + + +PyObject * _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, const char *format, ...) { @@ -682,6 +705,17 @@ _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, } +PyObject * _PyObject_CallMethodFormat(PyThreadState *tstate, PyObject *callable, + const char *format, ...) +{ + va_list va; + va_start(va, format); + PyObject *retval = callmethod(tstate, callable, format, va, 0); + va_end(va); + return retval; +} + + PyObject * _PyObject_CallMethod_SizeT(PyObject *obj, const char *name, const char *format, ...) |