Add _PyObject_VaCallFunctionObjArgs() private function

Issue #28915: Similar to _PyObject_CallFunctionObjArgs() but use va_list to
pass arguments.
This commit is contained in:
Victor Stinner 2016-12-09 00:40:33 +01:00
parent dbe28d26b4
commit 7f39c0ccfc
2 changed files with 11 additions and 5 deletions

View File

@ -437,6 +437,12 @@ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...);
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyObject_VaCallFunctionObjArgs(
PyObject *callable,
va_list vargs);
#endif
/*
Call the method named 'name' of object 'obj' with a variable number of
C arguments. The C arguments are provided as PyObject *

View File

@ -2706,8 +2706,8 @@ _PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name,
return retval;
}
static PyObject *
_PyObject_FastCallVa(PyObject *callable, va_list vargs)
PyObject *
_PyObject_VaCallFunctionObjArgs(PyObject *callable, va_list vargs)
{
PyObject *small_stack[5];
PyObject **stack;
@ -2773,7 +2773,7 @@ PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...)
}
va_start(vargs, name);
result = _PyObject_FastCallVa(callable, vargs);
result = _PyObject_VaCallFunctionObjArgs(callable, vargs);
va_end(vargs);
Py_DECREF(callable);
@ -2797,7 +2797,7 @@ _PyObject_CallMethodIdObjArgs(PyObject *obj,
}
va_start(vargs, name);
result = _PyObject_FastCallVa(callable, vargs);
result = _PyObject_VaCallFunctionObjArgs(callable, vargs);
va_end(vargs);
Py_DECREF(callable);
@ -2811,7 +2811,7 @@ PyObject_CallFunctionObjArgs(PyObject *callable, ...)
PyObject *result;
va_start(vargs, callable);
result = _PyObject_FastCallVa(callable, vargs);
result = _PyObject_VaCallFunctionObjArgs(callable, vargs);
va_end(vargs);
return result;