summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-07-10 22:20:32 (GMT)
committerBrett Cannon <bcannon@gmail.com>2004-07-10 22:20:32 (GMT)
commit711e7d97e4bebec002233e7caa72fc43ffba06a5 (patch)
tree80f45e962986f89ebc408731e51b276d0ab741f3 /Python/getargs.c
parent9a2a1cb031f9149ca6bfaf7b43ae0955d16db9b1 (diff)
downloadcpython-711e7d97e4bebec002233e7caa72fc43ffba06a5.zip
cpython-711e7d97e4bebec002233e7caa72fc43ffba06a5.tar.gz
cpython-711e7d97e4bebec002233e7caa72fc43ffba06a5.tar.bz2
Add PyArg_VaParseTupleAndKeywords(). Document this function and
PyArg_VaParse(). Closes patch #550732. Thanks Greg Chapman.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c36
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)