summaryrefslogtreecommitdiffstats
path: root/Include/modsupport.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-03-14 08:32:22 (GMT)
committerGitHub <noreply@github.com>2019-03-14 08:32:22 (GMT)
commit3191391515824fa7f3c573d807f1034c6a28fab3 (patch)
treeff8213b07b206de4df88dc352ee957ce68f0f2de /Include/modsupport.h
parent2c0d3f454705bb5ccf5f6189f3cf77bbae4f056b (diff)
downloadcpython-3191391515824fa7f3c573d807f1034c6a28fab3.zip
cpython-3191391515824fa7f3c573d807f1034c6a28fab3.tar.gz
cpython-3191391515824fa7f3c573d807f1034c6a28fab3.tar.bz2
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)
Diffstat (limited to 'Include/modsupport.h')
-rw-r--r--Include/modsupport.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/modsupport.h b/Include/modsupport.h
index f17060c..66a5ec8 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -118,6 +118,18 @@ PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
...);
PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
struct _PyArg_Parser *, va_list);
+PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
+ PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwargs, PyObject *kwnames,
+ struct _PyArg_Parser *parser,
+ int minpos, int maxpos, int minkw,
+ PyObject **buf);
+#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
+ (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
+ (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
+ _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
+ (minpos), (maxpos), (minkw), (buf)))
+
void _PyArg_Fini(void);
#endif /* Py_LIMITED_API */