Skip to content

Commit 16410c3

Browse files
committed
Allow zero vararg arguments for 'PyArg_ParseTupleAndKeywords'.
1 parent cf9301c commit 16410c3

File tree

1 file changed

+4
-3
lines changed
  • graalpython/com.oracle.graal.python.cext/include

1 file changed

+4
-3
lines changed

graalpython/com.oracle.graal.python.cext/include/Python.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158

159159
extern int PyTruffle_Arg_ParseTupleAndKeywords(PyObject *argv, PyObject *kwds, const char *format, char** kwdnames, int outc, void *v0, void *v1, void *v2, void *v3, void *v4, void *v5, void *v6, void *v7, void *v8, void *v9, void *v10, void *v11, void *v12, void *v13, void *v14, void *v15, void *v16, void *v17, void *v18, void *v19);
160160

161+
#define PyTruffle_Arg_ParseTupleAndKeywords_0(ARGV, KWDS, FORMAT, KWDNAMES) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
161162
#define PyTruffle_Arg_ParseTupleAndKeywords_1(ARGV, KWDS, FORMAT, KWDNAMES, V1) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 1, (void*)V1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
162163
#define PyTruffle_Arg_ParseTupleAndKeywords_2(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 2, (void*)V1, (void*)V2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
163164
#define PyTruffle_Arg_ParseTupleAndKeywords_3(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 3, (void*)V1, (void*)V2, (void*)V3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
@@ -178,16 +179,16 @@ extern int PyTruffle_Arg_ParseTupleAndKeywords(PyObject *argv, PyObject *kwds, c
178179
#define PyTruffle_Arg_ParseTupleAndKeywords_18(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 18, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, NULL, NULL)
179180
#define PyTruffle_Arg_ParseTupleAndKeywords_19(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 19, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, (void*)V19, NULL)
180181
#define PyTruffle_Arg_ParseTupleAndKeywords_20(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 20, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, (void*)V19, (void*)V20)
181-
#define ARG_PARSE_TUPLE_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME
182+
#define ARG_PARSE_TUPLE_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME
182183
#ifdef PyArg_ParseTupleAndKeywords
183184
#undef PyArg_ParseTupleAndKeywords
184185
#endif
185-
#define PyArg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, ...) ARG_PARSE_TUPLE_IMPL(__VA_ARGS__, PyTruffle_Arg_ParseTupleAndKeywords_20, PyTruffle_Arg_ParseTupleAndKeywords_19, PyTruffle_Arg_ParseTupleAndKeywords_18, PyTruffle_Arg_ParseTupleAndKeywords_17, PyTruffle_Arg_ParseTupleAndKeywords_16, PyTruffle_Arg_ParseTupleAndKeywords_15, PyTruffle_Arg_ParseTupleAndKeywords_14, PyTruffle_Arg_ParseTupleAndKeywords_13, PyTruffle_Arg_ParseTupleAndKeywords_12, PyTruffle_Arg_ParseTupleAndKeywords_11, PyTruffle_Arg_ParseTupleAndKeywords_10, PyTruffle_Arg_ParseTupleAndKeywords_9, PyTruffle_Arg_ParseTupleAndKeywords_8, PyTruffle_Arg_ParseTupleAndKeywords_7, PyTruffle_Arg_ParseTupleAndKeywords_6, PyTruffle_Arg_ParseTupleAndKeywords_5, PyTruffle_Arg_ParseTupleAndKeywords_4, PyTruffle_Arg_ParseTupleAndKeywords_3, PyTruffle_Arg_ParseTupleAndKeywords_2, PyTruffle_Arg_ParseTupleAndKeywords_1)(ARGV, KWDS, FORMAT, KWDNAMES, __VA_ARGS__)
186+
#define PyArg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, ...) ARG_PARSE_TUPLE_IMPL(__VA_ARGS__, PyTruffle_Arg_ParseTupleAndKeywords_20, PyTruffle_Arg_ParseTupleAndKeywords_19, PyTruffle_Arg_ParseTupleAndKeywords_18, PyTruffle_Arg_ParseTupleAndKeywords_17, PyTruffle_Arg_ParseTupleAndKeywords_16, PyTruffle_Arg_ParseTupleAndKeywords_15, PyTruffle_Arg_ParseTupleAndKeywords_14, PyTruffle_Arg_ParseTupleAndKeywords_13, PyTruffle_Arg_ParseTupleAndKeywords_12, PyTruffle_Arg_ParseTupleAndKeywords_11, PyTruffle_Arg_ParseTupleAndKeywords_10, PyTruffle_Arg_ParseTupleAndKeywords_9, PyTruffle_Arg_ParseTupleAndKeywords_8, PyTruffle_Arg_ParseTupleAndKeywords_7, PyTruffle_Arg_ParseTupleAndKeywords_6, PyTruffle_Arg_ParseTupleAndKeywords_5, PyTruffle_Arg_ParseTupleAndKeywords_4, PyTruffle_Arg_ParseTupleAndKeywords_3, PyTruffle_Arg_ParseTupleAndKeywords_2, PyTruffle_Arg_ParseTupleAndKeywords_1, PyTruffle_Arg_ParseTupleAndKeywords_0)(ARGV, KWDS, FORMAT, __VA_ARGS__)
186187

187188
#ifdef PyArg_ParseTuple
188189
#undef PyArg_ParseTuple
189190
#endif
190-
#define PyArg_ParseTuple(ARGV, FORMAT, ...) PyArg_ParseTupleAndKeywords(ARGV, PyDict_New(), FORMAT, (char*[]) { NULL }, __VA_ARGS__)
191+
#define PyArg_ParseTuple(ARGV, FORMAT, ...) PyArg_ParseTupleAndKeywords(ARGV, PyDict_New(), FORMAT, (char*[]) { NULL }, ##__VA_ARGS__)
191192

192193
#ifdef _PyArg_ParseTupleAndKeywordsFast
193194
#undef _PyArg_ParseTupleAndKeywordsFast

0 commit comments

Comments
 (0)