diff options
Diffstat (limited to 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 72194a8..cd7633c 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -12,6 +12,9 @@ int PyArg_VaParse(PyObject *, char *, va_list); int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, char *, char **, ...); +int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, + char *, char **, va_list); + /* Forward */ static int vgetargs1(PyObject *, char *, va_list *, int); @@ -1153,6 +1156,39 @@ PyArg_ParseTupleAndKeywords(PyObject *args, } +int +PyArg_VaParseTupleAndKeywords(PyObject *args, + PyObject *keywords, + char *format, + char **kwlist, va_list va) +{ + int retval; + va_list lva; + + if ((args == NULL || !PyTuple_Check(args)) || + (keywords != NULL && !PyDict_Check(keywords)) || + format == NULL || + kwlist == NULL) + { + PyErr_BadInternalCall(); + return 0; + } + +#ifdef VA_LIST_IS_ARRAY + memcpy(lva, va, sizeof(va_list)); +#else +#ifdef __va_copy + __va_copy(lva, va); +#else + lva = va; +#endif +#endif + + retval = vgetargskeywords(args, keywords, format, kwlist, &lva); + return retval; +} + + static int vgetargskeywords(PyObject *args, PyObject *keywords, char *format, char **kwlist, va_list *p_va) |