Skip to content

Commit 2a4efd1

Browse files
committed
remove PyArg_ParseTupleAndKeywords macro version
1 parent 1358b6c commit 2a4efd1

File tree

2 files changed

+4
-54
lines changed

2 files changed

+4
-54
lines changed

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -153,35 +153,6 @@
153153
#undef Py_RETURN_NONE
154154
#define Py_RETURN_NONE return Py_None;
155155

156-
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);
157-
158-
#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)
159-
#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)
160-
#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)
161-
#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)
162-
#define PyTruffle_Arg_ParseTupleAndKeywords_4(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 4, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
163-
#define PyTruffle_Arg_ParseTupleAndKeywords_5(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 5, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
164-
#define PyTruffle_Arg_ParseTupleAndKeywords_6(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 6, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
165-
#define PyTruffle_Arg_ParseTupleAndKeywords_7(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 7, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
166-
#define PyTruffle_Arg_ParseTupleAndKeywords_8(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 8, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), (void*)(V8), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
167-
#define PyTruffle_Arg_ParseTupleAndKeywords_9(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 9, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), (void*)(V8), (void*)(V9), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
168-
#define PyTruffle_Arg_ParseTupleAndKeywords_10(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 10, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), (void*)(V8), (void*)(V9), (void*)(V10), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
169-
#define PyTruffle_Arg_ParseTupleAndKeywords_11(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 11, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), (void*)(V8), (void*)(V9), (void*)(V10), (void*)(V11), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
170-
#define PyTruffle_Arg_ParseTupleAndKeywords_12(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 12, (void*)(V1), (void*)(V2), (void*)(V3), (void*)(V4), (void*)(V5), (void*)(V6), (void*)(V7), (void*)(V8), (void*)(V9), (void*)(V10), (void*)(V11), (void*)(V12), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
171-
#define PyTruffle_Arg_ParseTupleAndKeywords_13(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 13, (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), NULL, NULL, NULL, NULL, NULL, NULL, NULL)
172-
#define PyTruffle_Arg_ParseTupleAndKeywords_14(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 14, (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), NULL, NULL, NULL, NULL, NULL, NULL)
173-
#define PyTruffle_Arg_ParseTupleAndKeywords_15(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 15, (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), NULL, NULL, NULL, NULL, NULL)
174-
#define PyTruffle_Arg_ParseTupleAndKeywords_16(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 16, (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), NULL, NULL, NULL, NULL)
175-
#define PyTruffle_Arg_ParseTupleAndKeywords_17(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 17, (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), NULL, NULL, NULL)
176-
#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)
177-
#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)
178-
#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)
179-
#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
180-
#ifdef PyArg_ParseTupleAndKeywords
181-
#undef PyArg_ParseTupleAndKeywords
182-
#endif
183-
#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__)
184-
185156
#ifdef PyArg_ParseTuple
186157
#undef PyArg_ParseTuple
187158
#endif

graalpython/com.oracle.graal.python.cext/src/modsupport.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,11 @@ PyObject* PyTruffle_GetArg(positional_argstack* p, PyObject* kwds, char** kwdnam
7272
if (PyErr_Occurred()) { \
7373
return 0; \
7474
} \
75-
switch(n) { \
76-
case 0: *((T*)v0) = __oai; break; \
77-
case 1: *((T*)v1) = __oai; break; \
78-
case 2: *((T*)v2) = __oai; break; \
79-
case 3: *((T*)v3) = __oai; break; \
80-
case 4: *((T*)v4) = __oai; break; \
81-
case 5: *((T*)v5) = __oai; break; \
82-
case 6: *((T*)v6) = __oai; break; \
83-
case 7: *((T*)v7) = __oai; break; \
84-
case 8: *((T*)v8) = __oai; break; \
85-
case 9: *((T*)v9) = __oai; break; \
86-
case 10: *((T*)v10) = __oai; break; \
87-
case 11: *((T*)v11) = __oai; break; \
88-
case 12: *((T*)v12) = __oai; break; \
89-
case 13: *((T*)v13) = __oai; break; \
90-
case 14: *((T*)v14) = __oai; break; \
91-
case 15: *((T*)v15) = __oai; break; \
92-
case 16: *((T*)v16) = __oai; break; \
93-
case 17: *((T*)v17) = __oai; break; \
94-
case 18: *((T*)v18) = __oai; break; \
95-
case 19: *((T*)v19) = __oai; break; \
96-
} \
75+
*((T*)polyglot_get_arg(n)) = __oai; \
9776
n++; \
9877
} while(0);
9978

100-
#define PyTruffle_ArgN(n) (((n) == 0) ? v0 : (((n) == 1) ? v1 : (((n) == 2) ? v2 : (((n) == 3) ? v3 : (((n) == 4) ? v4 : (((n) == 5) ? v5 : (((n) == 6) ? v6 : (((n) == 7) ? v7 : (((n) == 8) ? v8 : (((n) == 9) ? v9 : (((n) == 10) ? v10 : (((n) == 11) ? v11 : (((n) == 12) ? v12 : (((n) == 13) ? v13 : (((n) == 14) ? v14 : (((n) == 15) ? v15 : (((n) == 16) ? v16 : (((n) == 17) ? v17 : (((n) == 18) ? v18 : (((n) == 19) ? v19 : NULL))))))))))))))))))))
79+
#define PyTruffle_ArgN(n) polyglot_get_arg(n)
10180

10281
#define PyTruffle_SkipOptionalArg(n, arg, optional) \
10382
if (arg == NULL && optional) { \
@@ -107,10 +86,10 @@ PyObject* PyTruffle_GetArg(positional_argstack* p, PyObject* kwds, char** kwdnam
10786

10887
/* argparse */
10988
UPCALL_ID(__bool__);
110-
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) {
89+
int PyArg_ParseTupleAndKeywords(PyObject *argv, PyObject *kwds, const char *format, char** kwdnames, ...) {
11190
PyObject* arg;
11291
int format_idx = 0;
113-
int output_idx = 0;
92+
int output_idx = 4;
11493
unsigned char rest_optional = 0;
11594
unsigned char rest_keywords_only = 0;
11695

0 commit comments

Comments
 (0)