Debian Codegraph @

Lib/test/clinic.test.c

raw
1 /*[clinic input]
2 output preset block
3 [clinic start generated code]*/
4 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=3c81ac2402d06a8b]*/
5
6 /*[clinic input]
7 module m
8 class m.T "TestObj *" "TestType"
9 class Test "TestObj *" "TestType"
10 [clinic start generated code]*/
11 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f761b4d55cb179cf]*/
12
13 /*[clinic input]
14 test_object_converter
15
16 a: object
17 b: object(converter="PyUnicode_FSConverter")
18 c: object(subclass_of="&PyUnicode_Type")
19 d: object(type="PyUnicode_Object *")
20 /
21
22 [clinic start generated code]*/
23
24 PyDoc_STRVAR(test_object_converter__doc__,
25 "test_object_converter($module, a, b, c, d, /)\n"
26 "--\n"
27 "\n");
28
29 #define TEST_OBJECT_CONVERTER_METHODDEF \
30 {"test_object_converter", _PyCFunction_CAST(test_object_converter), METH_FASTCALL, test_object_converter__doc__},
31
32 static PyObject *
33 test_object_converter_impl(PyObject *module, PyObject *a, PyObject *b,
34 PyObject *c, PyUnicode_Object *d);
35
36 static PyObject *
37 test_object_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
38 {
39 PyObject *return_value = NULL;
40 PyObject *a;
41 PyObject *b;
42 PyObject *c;
43 PyUnicode_Object *d;
44
45 if (!_PyArg_CheckPositional("test_object_converter", nargs, 4, 4)) {
46 goto exit;
47 }
48 a = args[0];
49 if (!PyUnicode_FSConverter(args[1], &b)) {
50 goto exit;
51 }
52 if (!PyUnicode_Check(args[2])) {
53 _PyArg_BadArgument("test_object_converter", "argument 3", "str", args[2]);
54 goto exit;
55 }
56 c = args[2];
57 d = (PyUnicode_Object *)args[3];
58 return_value = test_object_converter_impl(module, a, b, c, d);
59
60 exit:
61 return return_value;
62 }
63
64 static PyObject *
65 test_object_converter_impl(PyObject *module, PyObject *a, PyObject *b,
66 PyObject *c, PyUnicode_Object *d)
67 /*[clinic end generated code: output=886f4f9b598726b6 input=005e6a8a711a869b]*/
68
69
70 /*[clinic input]
71 cloned = test_object_converter
72 Check the clone feature.
73 [clinic start generated code]*/
74
75 PyDoc_STRVAR(cloned__doc__,
76 "cloned($module, a, b, c, d, /)\n"
77 "--\n"
78 "\n"
79 "Check the clone feature.");
80
81 #define CLONED_METHODDEF \
82 {"cloned", _PyCFunction_CAST(cloned), METH_FASTCALL, cloned__doc__},
83
84 static PyObject *
85 cloned_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c,
86 PyUnicode_Object *d);
87
88 static PyObject *
89 cloned(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
90 {
91 PyObject *return_value = NULL;
92 PyObject *a;
93 PyObject *b;
94 PyObject *c;
95 PyUnicode_Object *d;
96
97 if (!_PyArg_CheckPositional("cloned", nargs, 4, 4)) {
98 goto exit;
99 }
100 a = args[0];
101 if (!PyUnicode_FSConverter(args[1], &b)) {
102 goto exit;
103 }
104 if (!PyUnicode_Check(args[2])) {
105 _PyArg_BadArgument("cloned", "argument 3", "str", args[2]);
106 goto exit;
107 }
108 c = args[2];
109 d = (PyUnicode_Object *)args[3];
110 return_value = cloned_impl(module, a, b, c, d);
111
112 exit:
113 return return_value;
114 }
115
116 static PyObject *
117 cloned_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c,
118 PyUnicode_Object *d)
119 /*[clinic end generated code: output=026b483e27c38065 input=0543614019d6fcc7]*/
120
121
122 /*[clinic input]
123 test_object_converter_one_arg
124
125 a: object
126 /
127
128 [clinic start generated code]*/
129
130 PyDoc_STRVAR(test_object_converter_one_arg__doc__,
131 "test_object_converter_one_arg($module, a, /)\n"
132 "--\n"
133 "\n");
134
135 #define TEST_OBJECT_CONVERTER_ONE_ARG_METHODDEF \
136 {"test_object_converter_one_arg", (PyCFunction)test_object_converter_one_arg, METH_O, test_object_converter_one_arg__doc__},
137
138 static PyObject *
139 test_object_converter_one_arg(PyObject *module, PyObject *a)
140 /*[clinic end generated code: output=6da755f8502139df input=d635d92a421f1ca3]*/
141
142
143 /*[clinic input]
144 test_objects_converter
145
146 a: object
147 b: object = NULL
148 /
149
150 [clinic start generated code]*/
151
152 PyDoc_STRVAR(test_objects_converter__doc__,
153 "test_objects_converter($module, a, b=<unrepresentable>, /)\n"
154 "--\n"
155 "\n");
156
157 #define TEST_OBJECTS_CONVERTER_METHODDEF \
158 {"test_objects_converter", _PyCFunction_CAST(test_objects_converter), METH_FASTCALL, test_objects_converter__doc__},
159
160 static PyObject *
161 test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b);
162
163 static PyObject *
164 test_objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
165 {
166 PyObject *return_value = NULL;
167 PyObject *a;
168 PyObject *b = NULL;
169
170 if (!_PyArg_CheckPositional("test_objects_converter", nargs, 1, 2)) {
171 goto exit;
172 }
173 a = args[0];
174 if (nargs < 2) {
175 goto skip_optional;
176 }
177 b = args[1];
178 skip_optional:
179 return_value = test_objects_converter_impl(module, a, b);
180
181 exit:
182 return return_value;
183 }
184
185 static PyObject *
186 test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
187 /*[clinic end generated code: output=fc26328b79d46bb7 input=4cbb3d9edd2a36f3]*/
188
189
190 /*[clinic input]
191 test_object_converter_subclass_of
192
193 a: object(subclass_of="&PyLong_Type")
194 b: object(subclass_of="&PyTuple_Type")
195 c: object(subclass_of="&PyList_Type")
196 d: object(subclass_of="&PySet_Type")
197 e: object(subclass_of="&PyFrozenSet_Type")
198 f: object(subclass_of="&PyDict_Type")
199 g: object(subclass_of="&PyUnicode_Type")
200 h: object(subclass_of="&PyBytes_Type")
201 i: object(subclass_of="&PyByteArray_Type")
202 j: object(subclass_of="&MyType")
203 /
204
205 [clinic start generated code]*/
206
207 PyDoc_STRVAR(test_object_converter_subclass_of__doc__,
208 "test_object_converter_subclass_of($module, a, b, c, d, e, f, g, h, i,\n"
209 " j, /)\n"
210 "--\n"
211 "\n");
212
213 #define TEST_OBJECT_CONVERTER_SUBCLASS_OF_METHODDEF \
214 {"test_object_converter_subclass_of", _PyCFunction_CAST(test_object_converter_subclass_of), METH_FASTCALL, test_object_converter_subclass_of__doc__},
215
216 static PyObject *
217 test_object_converter_subclass_of_impl(PyObject *module, PyObject *a,
218 PyObject *b, PyObject *c, PyObject *d,
219 PyObject *e, PyObject *f, PyObject *g,
220 PyObject *h, PyObject *i, PyObject *j);
221
222 static PyObject *
223 test_object_converter_subclass_of(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
224 {
225 PyObject *return_value = NULL;
226 PyObject *a;
227 PyObject *b;
228 PyObject *c;
229 PyObject *d;
230 PyObject *e;
231 PyObject *f;
232 PyObject *g;
233 PyObject *h;
234 PyObject *i;
235 PyObject *j;
236
237 if (!_PyArg_CheckPositional("test_object_converter_subclass_of", nargs, 10, 10)) {
238 goto exit;
239 }
240 if (!PyLong_Check(args[0])) {
241 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 1", "int", args[0]);
242 goto exit;
243 }
244 a = args[0];
245 if (!PyTuple_Check(args[1])) {
246 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 2", "tuple", args[1]);
247 goto exit;
248 }
249 b = args[1];
250 if (!PyList_Check(args[2])) {
251 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 3", "list", args[2]);
252 goto exit;
253 }
254 c = args[2];
255 if (!PySet_Check(args[3])) {
256 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 4", "set", args[3]);
257 goto exit;
258 }
259 d = args[3];
260 if (!PyFrozenSet_Check(args[4])) {
261 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 5", "frozenset", args[4]);
262 goto exit;
263 }
264 e = args[4];
265 if (!PyDict_Check(args[5])) {
266 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 6", "dict", args[5]);
267 goto exit;
268 }
269 f = args[5];
270 if (!PyUnicode_Check(args[6])) {
271 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 7", "str", args[6]);
272 goto exit;
273 }
274 g = args[6];
275 if (!PyBytes_Check(args[7])) {
276 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 8", "bytes", args[7]);
277 goto exit;
278 }
279 h = args[7];
280 if (!PyByteArray_Check(args[8])) {
281 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 9", "bytearray", args[8]);
282 goto exit;
283 }
284 i = args[8];
285 if (!PyObject_TypeCheck(args[9], &MyType)) {
286 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 10", (&MyType)->tp_name, args[9]);
287 goto exit;
288 }
289 j = args[9];
290 return_value = test_object_converter_subclass_of_impl(module, a, b, c, d, e, f, g, h, i, j);
291
292 exit:
293 return return_value;
294 }
295
296 static PyObject *
297 test_object_converter_subclass_of_impl(PyObject *module, PyObject *a,
298 PyObject *b, PyObject *c, PyObject *d,
299 PyObject *e, PyObject *f, PyObject *g,
300 PyObject *h, PyObject *i, PyObject *j)
301 /*[clinic end generated code: output=e4b07c9a54479a40 input=31b06b772d5f983e]*/
302
303
304 /*[clinic input]
305 test_PyBytesObject_converter
306
307 a: PyBytesObject
308 /
309
310 [clinic start generated code]*/
311
312 PyDoc_STRVAR(test_PyBytesObject_converter__doc__,
313 "test_PyBytesObject_converter($module, a, /)\n"
314 "--\n"
315 "\n");
316
317 #define TEST_PYBYTESOBJECT_CONVERTER_METHODDEF \
318 {"test_PyBytesObject_converter", (PyCFunction)test_PyBytesObject_converter, METH_O, test_PyBytesObject_converter__doc__},
319
320 static PyObject *
321 test_PyBytesObject_converter_impl(PyObject *module, PyBytesObject *a);
322
323 static PyObject *
324 test_PyBytesObject_converter(PyObject *module, PyObject *arg)
325 {
326 PyObject *return_value = NULL;
327 PyBytesObject *a;
328
329 if (!PyBytes_Check(arg)) {
330 _PyArg_BadArgument("test_PyBytesObject_converter", "argument", "bytes", arg);
331 goto exit;
332 }
333 a = (PyBytesObject *)arg;
334 return_value = test_PyBytesObject_converter_impl(module, a);
335
336 exit:
337 return return_value;
338 }
339
340 static PyObject *
341 test_PyBytesObject_converter_impl(PyObject *module, PyBytesObject *a)
342 /*[clinic end generated code: output=7539d628e6fceace input=12b10c7cb5750400]*/
343
344
345 /*[clinic input]
346 test_PyByteArrayObject_converter
347
348 a: PyByteArrayObject
349 /
350
351 [clinic start generated code]*/
352
353 PyDoc_STRVAR(test_PyByteArrayObject_converter__doc__,
354 "test_PyByteArrayObject_converter($module, a, /)\n"
355 "--\n"
356 "\n");
357
358 #define TEST_PYBYTEARRAYOBJECT_CONVERTER_METHODDEF \
359 {"test_PyByteArrayObject_converter", (PyCFunction)test_PyByteArrayObject_converter, METH_O, test_PyByteArrayObject_converter__doc__},
360
361 static PyObject *
362 test_PyByteArrayObject_converter_impl(PyObject *module, PyByteArrayObject *a);
363
364 static PyObject *
365 test_PyByteArrayObject_converter(PyObject *module, PyObject *arg)
366 {
367 PyObject *return_value = NULL;
368 PyByteArrayObject *a;
369
370 if (!PyByteArray_Check(arg)) {
371 _PyArg_BadArgument("test_PyByteArrayObject_converter", "argument", "bytearray", arg);
372 goto exit;
373 }
374 a = (PyByteArrayObject *)arg;
375 return_value = test_PyByteArrayObject_converter_impl(module, a);
376
377 exit:
378 return return_value;
379 }
380
381 static PyObject *
382 test_PyByteArrayObject_converter_impl(PyObject *module, PyByteArrayObject *a)
383 /*[clinic end generated code: output=1245af9f5b3e355e input=5a657da535d194ae]*/
384
385
386 /*[clinic input]
387 test_unicode_converter
388
389 a: unicode
390 /
391
392 [clinic start generated code]*/
393
394 PyDoc_STRVAR(test_unicode_converter__doc__,
395 "test_unicode_converter($module, a, /)\n"
396 "--\n"
397 "\n");
398
399 #define TEST_UNICODE_CONVERTER_METHODDEF \
400 {"test_unicode_converter", (PyCFunction)test_unicode_converter, METH_O, test_unicode_converter__doc__},
401
402 static PyObject *
403 test_unicode_converter_impl(PyObject *module, PyObject *a);
404
405 static PyObject *
406 test_unicode_converter(PyObject *module, PyObject *arg)
407 {
408 PyObject *return_value = NULL;
409 PyObject *a;
410
411 if (!PyUnicode_Check(arg)) {
412 _PyArg_BadArgument("test_unicode_converter", "argument", "str", arg);
413 goto exit;
414 }
415 a = arg;
416 return_value = test_unicode_converter_impl(module, a);
417
418 exit:
419 return return_value;
420 }
421
422 static PyObject *
423 test_unicode_converter_impl(PyObject *module, PyObject *a)
424 /*[clinic end generated code: output=8c1625cc272c1f3d input=aa33612df92aa9c5]*/
425
426
427 /*[clinic input]
428 test_bool_converter
429
430 a: bool = True
431 b: bool(accept={object}) = True
432 c: bool(accept={int}) = True
433 /
434
435 [clinic start generated code]*/
436
437 PyDoc_STRVAR(test_bool_converter__doc__,
438 "test_bool_converter($module, a=True, b=True, c=True, /)\n"
439 "--\n"
440 "\n");
441
442 #define TEST_BOOL_CONVERTER_METHODDEF \
443 {"test_bool_converter", _PyCFunction_CAST(test_bool_converter), METH_FASTCALL, test_bool_converter__doc__},
444
445 static PyObject *
446 test_bool_converter_impl(PyObject *module, int a, int b, int c);
447
448 static PyObject *
449 test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
450 {
451 PyObject *return_value = NULL;
452 int a = 1;
453 int b = 1;
454 int c = 1;
455
456 if (!_PyArg_CheckPositional("test_bool_converter", nargs, 0, 3)) {
457 goto exit;
458 }
459 if (nargs < 1) {
460 goto skip_optional;
461 }
462 a = PyObject_IsTrue(args[0]);
463 if (a < 0) {
464 goto exit;
465 }
466 if (nargs < 2) {
467 goto skip_optional;
468 }
469 b = PyObject_IsTrue(args[1]);
470 if (b < 0) {
471 goto exit;
472 }
473 if (nargs < 3) {
474 goto skip_optional;
475 }
476 c = PyLong_AsInt(args[2]);
477 if (c == -1 && PyErr_Occurred()) {
478 goto exit;
479 }
480 skip_optional:
481 return_value = test_bool_converter_impl(module, a, b, c);
482
483 exit:
484 return return_value;
485 }
486
487 static PyObject *
488 test_bool_converter_impl(PyObject *module, int a, int b, int c)
489 /*[clinic end generated code: output=3190e46490de0644 input=939854fa9f248c60]*/
490
491
492 /*[clinic input]
493 test_char_converter
494
495 a: char = b'A'
496 b: char = b'\a'
497 c: char = b'\b'
498 d: char = b'\t'
499 e: char = b'\n'
500 f: char = b'\v'
501 g: char = b'\f'
502 h: char = b'\r'
503 i: char = b'"'
504 j: char = b"'"
505 k: char = b'?'
506 l: char = b'\\'
507 m: char = b'\000'
508 n: char = b'\377'
509 /
510
511 [clinic start generated code]*/
512
513 PyDoc_STRVAR(test_char_converter__doc__,
514 "test_char_converter($module, a=b\'A\', b=b\'\\x07\', c=b\'\\x08\', d=b\'\\t\',\n"
515 " e=b\'\\n\', f=b\'\\x0b\', g=b\'\\x0c\', h=b\'\\r\', i=b\'\"\',\n"
516 " j=b\"\'\", k=b\'?\', l=b\'\\\\\', m=b\'\\x00\', n=b\'\\xff\', /)\n"
517 "--\n"
518 "\n");
519
520 #define TEST_CHAR_CONVERTER_METHODDEF \
521 {"test_char_converter", _PyCFunction_CAST(test_char_converter), METH_FASTCALL, test_char_converter__doc__},
522
523 static PyObject *
524 test_char_converter_impl(PyObject *module, char a, char b, char c, char d,
525 char e, char f, char g, char h, char i, char j,
526 char k, char l, char m, char n);
527
528 static PyObject *
529 test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
530 {
531 PyObject *return_value = NULL;
532 char a = 'A';
533 char b = '\x07';
534 char c = '\x08';
535 char d = '\t';
536 char e = '\n';
537 char f = '\x0b';
538 char g = '\x0c';
539 char h = '\r';
540 char i = '"';
541 char j = '\'';
542 char k = '?';
543 char l = '\\';
544 char m = '\x00';
545 char n = '\xff';
546
547 if (!_PyArg_CheckPositional("test_char_converter", nargs, 0, 14)) {
548 goto exit;
549 }
550 if (nargs < 1) {
551 goto skip_optional;
552 }
553 if (PyBytes_Check(args[0]) && PyBytes_GET_SIZE(args[0]) == 1) {
554 a = PyBytes_AS_STRING(args[0])[0];
555 }
556 else if (PyByteArray_Check(args[0]) && PyByteArray_GET_SIZE(args[0]) == 1) {
557 a = PyByteArray_AS_STRING(args[0])[0];
558 }
559 else {
560 _PyArg_BadArgument("test_char_converter", "argument 1", "a byte string of length 1", args[0]);
561 goto exit;
562 }
563 if (nargs < 2) {
564 goto skip_optional;
565 }
566 if (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) {
567 b = PyBytes_AS_STRING(args[1])[0];
568 }
569 else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) {
570 b = PyByteArray_AS_STRING(args[1])[0];
571 }
572 else {
573 _PyArg_BadArgument("test_char_converter", "argument 2", "a byte string of length 1", args[1]);
574 goto exit;
575 }
576 if (nargs < 3) {
577 goto skip_optional;
578 }
579 if (PyBytes_Check(args[2]) && PyBytes_GET_SIZE(args[2]) == 1) {
580 c = PyBytes_AS_STRING(args[2])[0];
581 }
582 else if (PyByteArray_Check(args[2]) && PyByteArray_GET_SIZE(args[2]) == 1) {
583 c = PyByteArray_AS_STRING(args[2])[0];
584 }
585 else {
586 _PyArg_BadArgument("test_char_converter", "argument 3", "a byte string of length 1", args[2]);
587 goto exit;
588 }
589 if (nargs < 4) {
590 goto skip_optional;
591 }
592 if (PyBytes_Check(args[3]) && PyBytes_GET_SIZE(args[3]) == 1) {
593 d = PyBytes_AS_STRING(args[3])[0];
594 }
595 else if (PyByteArray_Check(args[3]) && PyByteArray_GET_SIZE(args[3]) == 1) {
596 d = PyByteArray_AS_STRING(args[3])[0];
597 }
598 else {
599 _PyArg_BadArgument("test_char_converter", "argument 4", "a byte string of length 1", args[3]);
600 goto exit;
601 }
602 if (nargs < 5) {
603 goto skip_optional;
604 }
605 if (PyBytes_Check(args[4]) && PyBytes_GET_SIZE(args[4]) == 1) {
606 e = PyBytes_AS_STRING(args[4])[0];
607 }
608 else if (PyByteArray_Check(args[4]) && PyByteArray_GET_SIZE(args[4]) == 1) {
609 e = PyByteArray_AS_STRING(args[4])[0];
610 }
611 else {
612 _PyArg_BadArgument("test_char_converter", "argument 5", "a byte string of length 1", args[4]);
613 goto exit;
614 }
615 if (nargs < 6) {
616 goto skip_optional;
617 }
618 if (PyBytes_Check(args[5]) && PyBytes_GET_SIZE(args[5]) == 1) {
619 f = PyBytes_AS_STRING(args[5])[0];
620 }
621 else if (PyByteArray_Check(args[5]) && PyByteArray_GET_SIZE(args[5]) == 1) {
622 f = PyByteArray_AS_STRING(args[5])[0];
623 }
624 else {
625 _PyArg_BadArgument("test_char_converter", "argument 6", "a byte string of length 1", args[5]);
626 goto exit;
627 }
628 if (nargs < 7) {
629 goto skip_optional;
630 }
631 if (PyBytes_Check(args[6]) && PyBytes_GET_SIZE(args[6]) == 1) {
632 g = PyBytes_AS_STRING(args[6])[0];
633 }
634 else if (PyByteArray_Check(args[6]) && PyByteArray_GET_SIZE(args[6]) == 1) {
635 g = PyByteArray_AS_STRING(args[6])[0];
636 }
637 else {
638 _PyArg_BadArgument("test_char_converter", "argument 7", "a byte string of length 1", args[6]);
639 goto exit;
640 }
641 if (nargs < 8) {
642 goto skip_optional;
643 }
644 if (PyBytes_Check(args[7]) && PyBytes_GET_SIZE(args[7]) == 1) {
645 h = PyBytes_AS_STRING(args[7])[0];
646 }
647 else if (PyByteArray_Check(args[7]) && PyByteArray_GET_SIZE(args[7]) == 1) {
648 h = PyByteArray_AS_STRING(args[7])[0];
649 }
650 else {
651 _PyArg_BadArgument("test_char_converter", "argument 8", "a byte string of length 1", args[7]);
652 goto exit;
653 }
654 if (nargs < 9) {
655 goto skip_optional;
656 }
657 if (PyBytes_Check(args[8]) && PyBytes_GET_SIZE(args[8]) == 1) {
658 i = PyBytes_AS_STRING(args[8])[0];
659 }
660 else if (PyByteArray_Check(args[8]) && PyByteArray_GET_SIZE(args[8]) == 1) {
661 i = PyByteArray_AS_STRING(args[8])[0];
662 }
663 else {
664 _PyArg_BadArgument("test_char_converter", "argument 9", "a byte string of length 1", args[8]);
665 goto exit;
666 }
667 if (nargs < 10) {
668 goto skip_optional;
669 }
670 if (PyBytes_Check(args[9]) && PyBytes_GET_SIZE(args[9]) == 1) {
671 j = PyBytes_AS_STRING(args[9])[0];
672 }
673 else if (PyByteArray_Check(args[9]) && PyByteArray_GET_SIZE(args[9]) == 1) {
674 j = PyByteArray_AS_STRING(args[9])[0];
675 }
676 else {
677 _PyArg_BadArgument("test_char_converter", "argument 10", "a byte string of length 1", args[9]);
678 goto exit;
679 }
680 if (nargs < 11) {
681 goto skip_optional;
682 }
683 if (PyBytes_Check(args[10]) && PyBytes_GET_SIZE(args[10]) == 1) {
684 k = PyBytes_AS_STRING(args[10])[0];
685 }
686 else if (PyByteArray_Check(args[10]) && PyByteArray_GET_SIZE(args[10]) == 1) {
687 k = PyByteArray_AS_STRING(args[10])[0];
688 }
689 else {
690 _PyArg_BadArgument("test_char_converter", "argument 11", "a byte string of length 1", args[10]);
691 goto exit;
692 }
693 if (nargs < 12) {
694 goto skip_optional;
695 }
696 if (PyBytes_Check(args[11]) && PyBytes_GET_SIZE(args[11]) == 1) {
697 l = PyBytes_AS_STRING(args[11])[0];
698 }
699 else if (PyByteArray_Check(args[11]) && PyByteArray_GET_SIZE(args[11]) == 1) {
700 l = PyByteArray_AS_STRING(args[11])[0];
701 }
702 else {
703 _PyArg_BadArgument("test_char_converter", "argument 12", "a byte string of length 1", args[11]);
704 goto exit;
705 }
706 if (nargs < 13) {
707 goto skip_optional;
708 }
709 if (PyBytes_Check(args[12]) && PyBytes_GET_SIZE(args[12]) == 1) {
710 m = PyBytes_AS_STRING(args[12])[0];
711 }
712 else if (PyByteArray_Check(args[12]) && PyByteArray_GET_SIZE(args[12]) == 1) {
713 m = PyByteArray_AS_STRING(args[12])[0];
714 }
715 else {
716 _PyArg_BadArgument("test_char_converter", "argument 13", "a byte string of length 1", args[12]);
717 goto exit;
718 }
719 if (nargs < 14) {
720 goto skip_optional;
721 }
722 if (PyBytes_Check(args[13]) && PyBytes_GET_SIZE(args[13]) == 1) {
723 n = PyBytes_AS_STRING(args[13])[0];
724 }
725 else if (PyByteArray_Check(args[13]) && PyByteArray_GET_SIZE(args[13]) == 1) {
726 n = PyByteArray_AS_STRING(args[13])[0];
727 }
728 else {
729 _PyArg_BadArgument("test_char_converter", "argument 14", "a byte string of length 1", args[13]);
730 goto exit;
731 }
732 skip_optional:
733 return_value = test_char_converter_impl(module, a, b, c, d, e, f, g, h, i, j, k, l, m, n);
734
735 exit:
736 return return_value;
737 }
738
739 static PyObject *
740 test_char_converter_impl(PyObject *module, char a, char b, char c, char d,
741 char e, char f, char g, char h, char i, char j,
742 char k, char l, char m, char n)
743 /*[clinic end generated code: output=98589f02422fe6b1 input=e42330417a44feac]*/
744
745
746 /*[clinic input]
747 test_unsigned_char_converter
748
749 a: unsigned_char = 12
750 b: unsigned_char(bitwise=False) = 34
751 c: unsigned_char(bitwise=True) = 56
752 /
753
754 [clinic start generated code]*/
755
756 PyDoc_STRVAR(test_unsigned_char_converter__doc__,
757 "test_unsigned_char_converter($module, a=12, b=34, c=56, /)\n"
758 "--\n"
759 "\n");
760
761 #define TEST_UNSIGNED_CHAR_CONVERTER_METHODDEF \
762 {"test_unsigned_char_converter", _PyCFunction_CAST(test_unsigned_char_converter), METH_FASTCALL, test_unsigned_char_converter__doc__},
763
764 static PyObject *
765 test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
766 unsigned char b, unsigned char c);
767
768 static PyObject *
769 test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
770 {
771 PyObject *return_value = NULL;
772 unsigned char a = 12;
773 unsigned char b = 34;
774 unsigned char c = 56;
775
776 if (!_PyArg_CheckPositional("test_unsigned_char_converter", nargs, 0, 3)) {
777 goto exit;
778 }
779 if (nargs < 1) {
780 goto skip_optional;
781 }
782 {
783 long ival = PyLong_AsLong(args[0]);
784 if (ival == -1 && PyErr_Occurred()) {
785 goto exit;
786 }
787 else if (ival < 0) {
788 PyErr_SetString(PyExc_OverflowError,
789 "unsigned byte integer is less than minimum");
790 goto exit;
791 }
792 else if (ival > UCHAR_MAX) {
793 PyErr_SetString(PyExc_OverflowError,
794 "unsigned byte integer is greater than maximum");
795 goto exit;
796 }
797 else {
798 a = (unsigned char) ival;
799 }
800 }
801 if (nargs < 2) {
802 goto skip_optional;
803 }
804 {
805 long ival = PyLong_AsLong(args[1]);
806 if (ival == -1 && PyErr_Occurred()) {
807 goto exit;
808 }
809 else if (ival < 0) {
810 PyErr_SetString(PyExc_OverflowError,
811 "unsigned byte integer is less than minimum");
812 goto exit;
813 }
814 else if (ival > UCHAR_MAX) {
815 PyErr_SetString(PyExc_OverflowError,
816 "unsigned byte integer is greater than maximum");
817 goto exit;
818 }
819 else {
820 b = (unsigned char) ival;
821 }
822 }
823 if (nargs < 3) {
824 goto skip_optional;
825 }
826 {
827 unsigned long ival = PyLong_AsUnsignedLongMask(args[2]);
828 if (ival == (unsigned long)-1 && PyErr_Occurred()) {
829 goto exit;
830 }
831 else {
832 c = (unsigned char) ival;
833 }
834 }
835 skip_optional:
836 return_value = test_unsigned_char_converter_impl(module, a, b, c);
837
838 exit:
839 return return_value;
840 }
841
842 static PyObject *
843 test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
844 unsigned char b, unsigned char c)
845 /*[clinic end generated code: output=45920dbedc22eb55 input=021414060993e289]*/
846
847
848 /*[clinic input]
849 test_short_converter
850
851 a: short = 12
852 /
853
854 [clinic start generated code]*/
855
856 PyDoc_STRVAR(test_short_converter__doc__,
857 "test_short_converter($module, a=12, /)\n"
858 "--\n"
859 "\n");
860
861 #define TEST_SHORT_CONVERTER_METHODDEF \
862 {"test_short_converter", _PyCFunction_CAST(test_short_converter), METH_FASTCALL, test_short_converter__doc__},
863
864 static PyObject *
865 test_short_converter_impl(PyObject *module, short a);
866
867 static PyObject *
868 test_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
869 {
870 PyObject *return_value = NULL;
871 short a = 12;
872
873 if (!_PyArg_CheckPositional("test_short_converter", nargs, 0, 1)) {
874 goto exit;
875 }
876 if (nargs < 1) {
877 goto skip_optional;
878 }
879 {
880 long ival = PyLong_AsLong(args[0]);
881 if (ival == -1 && PyErr_Occurred()) {
882 goto exit;
883 }
884 else if (ival < SHRT_MIN) {
885 PyErr_SetString(PyExc_OverflowError,
886 "signed short integer is less than minimum");
887 goto exit;
888 }
889 else if (ival > SHRT_MAX) {
890 PyErr_SetString(PyExc_OverflowError,
891 "signed short integer is greater than maximum");
892 goto exit;
893 }
894 else {
895 a = (short) ival;
896 }
897 }
898 skip_optional:
899 return_value = test_short_converter_impl(module, a);
900
901 exit:
902 return return_value;
903 }
904
905 static PyObject *
906 test_short_converter_impl(PyObject *module, short a)
907 /*[clinic end generated code: output=a580945bd6963d45 input=6a8a7a509a498ff4]*/
908
909
910 /*[clinic input]
911 test_unsigned_short_converter
912
913 a: unsigned_short = 12
914 b: unsigned_short(bitwise=False) = 34
915 c: unsigned_short(bitwise=True) = 56
916 /
917
918 [clinic start generated code]*/
919
920 PyDoc_STRVAR(test_unsigned_short_converter__doc__,
921 "test_unsigned_short_converter($module, a=12, b=34, c=56, /)\n"
922 "--\n"
923 "\n");
924
925 #define TEST_UNSIGNED_SHORT_CONVERTER_METHODDEF \
926 {"test_unsigned_short_converter", _PyCFunction_CAST(test_unsigned_short_converter), METH_FASTCALL, test_unsigned_short_converter__doc__},
927
928 static PyObject *
929 test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
930 unsigned short b, unsigned short c);
931
932 static PyObject *
933 test_unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
934 {
935 PyObject *return_value = NULL;
936 unsigned short a = 12;
937 unsigned short b = 34;
938 unsigned short c = 56;
939
940 if (!_PyArg_CheckPositional("test_unsigned_short_converter", nargs, 0, 3)) {
941 goto exit;
942 }
943 if (nargs < 1) {
944 goto skip_optional;
945 }
946 if (!_PyLong_UnsignedShort_Converter(args[0], &a)) {
947 goto exit;
948 }
949 if (nargs < 2) {
950 goto skip_optional;
951 }
952 if (!_PyLong_UnsignedShort_Converter(args[1], &b)) {
953 goto exit;
954 }
955 if (nargs < 3) {
956 goto skip_optional;
957 }
958 c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]);
959 if (c == (unsigned short)-1 && PyErr_Occurred()) {
960 goto exit;
961 }
962 skip_optional:
963 return_value = test_unsigned_short_converter_impl(module, a, b, c);
964
965 exit:
966 return return_value;
967 }
968
969 static PyObject *
970 test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
971 unsigned short b, unsigned short c)
972 /*[clinic end generated code: output=e6e990df729114fc input=cdfd8eff3d9176b4]*/
973
974
975 /*[clinic input]
976 test_int_converter
977
978 a: int = 12
979 b: int(accept={int}) = 34
980 c: int(accept={str}) = 45
981 d: int(type='myenum') = 67
982 /
983
984 [clinic start generated code]*/
985
986 PyDoc_STRVAR(test_int_converter__doc__,
987 "test_int_converter($module, a=12, b=34, c=45, d=67, /)\n"
988 "--\n"
989 "\n");
990
991 #define TEST_INT_CONVERTER_METHODDEF \
992 {"test_int_converter", _PyCFunction_CAST(test_int_converter), METH_FASTCALL, test_int_converter__doc__},
993
994 static PyObject *
995 test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d);
996
997 static PyObject *
998 test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
999 {
1000 PyObject *return_value = NULL;
1001 int a = 12;
1002 int b = 34;
1003 int c = 45;
1004 myenum d = 67;
1005
1006 if (!_PyArg_CheckPositional("test_int_converter", nargs, 0, 4)) {
1007 goto exit;
1008 }
1009 if (nargs < 1) {
1010 goto skip_optional;
1011 }
1012 a = PyLong_AsInt(args[0]);
1013 if (a == -1 && PyErr_Occurred()) {
1014 goto exit;
1015 }
1016 if (nargs < 2) {
1017 goto skip_optional;
1018 }
1019 b = PyLong_AsInt(args[1]);
1020 if (b == -1 && PyErr_Occurred()) {
1021 goto exit;
1022 }
1023 if (nargs < 3) {
1024 goto skip_optional;
1025 }
1026 if (!PyUnicode_Check(args[2])) {
1027 _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
1028 goto exit;
1029 }
1030 if (PyUnicode_GET_LENGTH(args[2]) != 1) {
1031 _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
1032 goto exit;
1033 }
1034 c = PyUnicode_READ_CHAR(args[2], 0);
1035 if (nargs < 4) {
1036 goto skip_optional;
1037 }
1038 d = PyLong_AsInt(args[3]);
1039 if (d == -1 && PyErr_Occurred()) {
1040 goto exit;
1041 }
1042 skip_optional:
1043 return_value = test_int_converter_impl(module, a, b, c, d);
1044
1045 exit:
1046 return return_value;
1047 }
1048
1049 static PyObject *
1050 test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
1051 /*[clinic end generated code: output=5aed87a7589eefb2 input=d20541fc1ca0553e]*/
1052
1053
1054 /*[clinic input]
1055 test_unsigned_int_converter
1056
1057 a: unsigned_int = 12
1058 b: unsigned_int(bitwise=False) = 34
1059 c: unsigned_int(bitwise=True) = 56
1060 /
1061
1062 [clinic start generated code]*/
1063
1064 PyDoc_STRVAR(test_unsigned_int_converter__doc__,
1065 "test_unsigned_int_converter($module, a=12, b=34, c=56, /)\n"
1066 "--\n"
1067 "\n");
1068
1069 #define TEST_UNSIGNED_INT_CONVERTER_METHODDEF \
1070 {"test_unsigned_int_converter", _PyCFunction_CAST(test_unsigned_int_converter), METH_FASTCALL, test_unsigned_int_converter__doc__},
1071
1072 static PyObject *
1073 test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
1074 unsigned int b, unsigned int c);
1075
1076 static PyObject *
1077 test_unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1078 {
1079 PyObject *return_value = NULL;
1080 unsigned int a = 12;
1081 unsigned int b = 34;
1082 unsigned int c = 56;
1083
1084 if (!_PyArg_CheckPositional("test_unsigned_int_converter", nargs, 0, 3)) {
1085 goto exit;
1086 }
1087 if (nargs < 1) {
1088 goto skip_optional;
1089 }
1090 if (!_PyLong_UnsignedInt_Converter(args[0], &a)) {
1091 goto exit;
1092 }
1093 if (nargs < 2) {
1094 goto skip_optional;
1095 }
1096 if (!_PyLong_UnsignedInt_Converter(args[1], &b)) {
1097 goto exit;
1098 }
1099 if (nargs < 3) {
1100 goto skip_optional;
1101 }
1102 c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]);
1103 if (c == (unsigned int)-1 && PyErr_Occurred()) {
1104 goto exit;
1105 }
1106 skip_optional:
1107 return_value = test_unsigned_int_converter_impl(module, a, b, c);
1108
1109 exit:
1110 return return_value;
1111 }
1112
1113 static PyObject *
1114 test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
1115 unsigned int b, unsigned int c)
1116 /*[clinic end generated code: output=f9cdbe410ccc98a3 input=5533534828b62fc0]*/
1117
1118
1119 /*[clinic input]
1120 test_long_converter
1121
1122 a: long = 12
1123 /
1124
1125 [clinic start generated code]*/
1126
1127 PyDoc_STRVAR(test_long_converter__doc__,
1128 "test_long_converter($module, a=12, /)\n"
1129 "--\n"
1130 "\n");
1131
1132 #define TEST_LONG_CONVERTER_METHODDEF \
1133 {"test_long_converter", _PyCFunction_CAST(test_long_converter), METH_FASTCALL, test_long_converter__doc__},
1134
1135 static PyObject *
1136 test_long_converter_impl(PyObject *module, long a);
1137
1138 static PyObject *
1139 test_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1140 {
1141 PyObject *return_value = NULL;
1142 long a = 12;
1143
1144 if (!_PyArg_CheckPositional("test_long_converter", nargs, 0, 1)) {
1145 goto exit;
1146 }
1147 if (nargs < 1) {
1148 goto skip_optional;
1149 }
1150 a = PyLong_AsLong(args[0]);
1151 if (a == -1 && PyErr_Occurred()) {
1152 goto exit;
1153 }
1154 skip_optional:
1155 return_value = test_long_converter_impl(module, a);
1156
1157 exit:
1158 return return_value;
1159 }
1160
1161 static PyObject *
1162 test_long_converter_impl(PyObject *module, long a)
1163 /*[clinic end generated code: output=02b3a83495c1d236 input=d2179e3c9cdcde89]*/
1164
1165
1166 /*[clinic input]
1167 test_unsigned_long_converter
1168
1169 a: unsigned_long = 12
1170 b: unsigned_long(bitwise=False) = 34
1171 c: unsigned_long(bitwise=True) = 56
1172 /
1173
1174 [clinic start generated code]*/
1175
1176 PyDoc_STRVAR(test_unsigned_long_converter__doc__,
1177 "test_unsigned_long_converter($module, a=12, b=34, c=56, /)\n"
1178 "--\n"
1179 "\n");
1180
1181 #define TEST_UNSIGNED_LONG_CONVERTER_METHODDEF \
1182 {"test_unsigned_long_converter", _PyCFunction_CAST(test_unsigned_long_converter), METH_FASTCALL, test_unsigned_long_converter__doc__},
1183
1184 static PyObject *
1185 test_unsigned_long_converter_impl(PyObject *module, unsigned long a,
1186 unsigned long b, unsigned long c);
1187
1188 static PyObject *
1189 test_unsigned_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1190 {
1191 PyObject *return_value = NULL;
1192 unsigned long a = 12;
1193 unsigned long b = 34;
1194 unsigned long c = 56;
1195
1196 if (!_PyArg_CheckPositional("test_unsigned_long_converter", nargs, 0, 3)) {
1197 goto exit;
1198 }
1199 if (nargs < 1) {
1200 goto skip_optional;
1201 }
1202 if (!_PyLong_UnsignedLong_Converter(args[0], &a)) {
1203 goto exit;
1204 }
1205 if (nargs < 2) {
1206 goto skip_optional;
1207 }
1208 if (!_PyLong_UnsignedLong_Converter(args[1], &b)) {
1209 goto exit;
1210 }
1211 if (nargs < 3) {
1212 goto skip_optional;
1213 }
1214 if (!PyLong_Check(args[2])) {
1215 _PyArg_BadArgument("test_unsigned_long_converter", "argument 3", "int", args[2]);
1216 goto exit;
1217 }
1218 c = PyLong_AsUnsignedLongMask(args[2]);
1219 skip_optional:
1220 return_value = test_unsigned_long_converter_impl(module, a, b, c);
1221
1222 exit:
1223 return return_value;
1224 }
1225
1226 static PyObject *
1227 test_unsigned_long_converter_impl(PyObject *module, unsigned long a,
1228 unsigned long b, unsigned long c)
1229 /*[clinic end generated code: output=540bb0ba2894e1fe input=f450d94cae1ef73b]*/
1230
1231
1232 /*[clinic input]
1233 test_long_long_converter
1234
1235 a: long_long = 12
1236 /
1237
1238 [clinic start generated code]*/
1239
1240 PyDoc_STRVAR(test_long_long_converter__doc__,
1241 "test_long_long_converter($module, a=12, /)\n"
1242 "--\n"
1243 "\n");
1244
1245 #define TEST_LONG_LONG_CONVERTER_METHODDEF \
1246 {"test_long_long_converter", _PyCFunction_CAST(test_long_long_converter), METH_FASTCALL, test_long_long_converter__doc__},
1247
1248 static PyObject *
1249 test_long_long_converter_impl(PyObject *module, long long a);
1250
1251 static PyObject *
1252 test_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1253 {
1254 PyObject *return_value = NULL;
1255 long long a = 12;
1256
1257 if (!_PyArg_CheckPositional("test_long_long_converter", nargs, 0, 1)) {
1258 goto exit;
1259 }
1260 if (nargs < 1) {
1261 goto skip_optional;
1262 }
1263 a = PyLong_AsLongLong(args[0]);
1264 if (a == -1 && PyErr_Occurred()) {
1265 goto exit;
1266 }
1267 skip_optional:
1268 return_value = test_long_long_converter_impl(module, a);
1269
1270 exit:
1271 return return_value;
1272 }
1273
1274 static PyObject *
1275 test_long_long_converter_impl(PyObject *module, long long a)
1276 /*[clinic end generated code: output=f9d4ed79ad2db857 input=d5fc81577ff4dd02]*/
1277
1278
1279 /*[clinic input]
1280 test_unsigned_long_long_converter
1281
1282 a: unsigned_long_long = 12
1283 b: unsigned_long_long(bitwise=False) = 34
1284 c: unsigned_long_long(bitwise=True) = 56
1285 /
1286
1287 [clinic start generated code]*/
1288
1289 PyDoc_STRVAR(test_unsigned_long_long_converter__doc__,
1290 "test_unsigned_long_long_converter($module, a=12, b=34, c=56, /)\n"
1291 "--\n"
1292 "\n");
1293
1294 #define TEST_UNSIGNED_LONG_LONG_CONVERTER_METHODDEF \
1295 {"test_unsigned_long_long_converter", _PyCFunction_CAST(test_unsigned_long_long_converter), METH_FASTCALL, test_unsigned_long_long_converter__doc__},
1296
1297 static PyObject *
1298 test_unsigned_long_long_converter_impl(PyObject *module,
1299 unsigned long long a,
1300 unsigned long long b,
1301 unsigned long long c);
1302
1303 static PyObject *
1304 test_unsigned_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1305 {
1306 PyObject *return_value = NULL;
1307 unsigned long long a = 12;
1308 unsigned long long b = 34;
1309 unsigned long long c = 56;
1310
1311 if (!_PyArg_CheckPositional("test_unsigned_long_long_converter", nargs, 0, 3)) {
1312 goto exit;
1313 }
1314 if (nargs < 1) {
1315 goto skip_optional;
1316 }
1317 if (!_PyLong_UnsignedLongLong_Converter(args[0], &a)) {
1318 goto exit;
1319 }
1320 if (nargs < 2) {
1321 goto skip_optional;
1322 }
1323 if (!_PyLong_UnsignedLongLong_Converter(args[1], &b)) {
1324 goto exit;
1325 }
1326 if (nargs < 3) {
1327 goto skip_optional;
1328 }
1329 if (!PyLong_Check(args[2])) {
1330 _PyArg_BadArgument("test_unsigned_long_long_converter", "argument 3", "int", args[2]);
1331 goto exit;
1332 }
1333 c = PyLong_AsUnsignedLongLongMask(args[2]);
1334 skip_optional:
1335 return_value = test_unsigned_long_long_converter_impl(module, a, b, c);
1336
1337 exit:
1338 return return_value;
1339 }
1340
1341 static PyObject *
1342 test_unsigned_long_long_converter_impl(PyObject *module,
1343 unsigned long long a,
1344 unsigned long long b,
1345 unsigned long long c)
1346 /*[clinic end generated code: output=3d69994f618b46bb input=a15115dc41866ff4]*/
1347
1348
1349 /*[clinic input]
1350 test_Py_ssize_t_converter
1351
1352 a: Py_ssize_t = 12
1353 b: Py_ssize_t(accept={int}) = 34
1354 c: Py_ssize_t(accept={int, NoneType}) = 56
1355 /
1356
1357 [clinic start generated code]*/
1358
1359 PyDoc_STRVAR(test_Py_ssize_t_converter__doc__,
1360 "test_Py_ssize_t_converter($module, a=12, b=34, c=56, /)\n"
1361 "--\n"
1362 "\n");
1363
1364 #define TEST_PY_SSIZE_T_CONVERTER_METHODDEF \
1365 {"test_Py_ssize_t_converter", _PyCFunction_CAST(test_Py_ssize_t_converter), METH_FASTCALL, test_Py_ssize_t_converter__doc__},
1366
1367 static PyObject *
1368 test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1369 Py_ssize_t c);
1370
1371 static PyObject *
1372 test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1373 {
1374 PyObject *return_value = NULL;
1375 Py_ssize_t a = 12;
1376 Py_ssize_t b = 34;
1377 Py_ssize_t c = 56;
1378
1379 if (!_PyArg_CheckPositional("test_Py_ssize_t_converter", nargs, 0, 3)) {
1380 goto exit;
1381 }
1382 if (nargs < 1) {
1383 goto skip_optional;
1384 }
1385 {
1386 Py_ssize_t ival = -1;
1387 PyObject *iobj = _PyNumber_Index(args[0]);
1388 if (iobj != NULL) {
1389 ival = PyLong_AsSsize_t(iobj);
1390 Py_DECREF(iobj);
1391 }
1392 if (ival == -1 && PyErr_Occurred()) {
1393 goto exit;
1394 }
1395 a = ival;
1396 }
1397 if (nargs < 2) {
1398 goto skip_optional;
1399 }
1400 {
1401 Py_ssize_t ival = -1;
1402 PyObject *iobj = _PyNumber_Index(args[1]);
1403 if (iobj != NULL) {
1404 ival = PyLong_AsSsize_t(iobj);
1405 Py_DECREF(iobj);
1406 }
1407 if (ival == -1 && PyErr_Occurred()) {
1408 goto exit;
1409 }
1410 b = ival;
1411 }
1412 if (nargs < 3) {
1413 goto skip_optional;
1414 }
1415 if (!_Py_convert_optional_to_ssize_t(args[2], &c)) {
1416 goto exit;
1417 }
1418 skip_optional:
1419 return_value = test_Py_ssize_t_converter_impl(module, a, b, c);
1420
1421 exit:
1422 return return_value;
1423 }
1424
1425 static PyObject *
1426 test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1427 Py_ssize_t c)
1428 /*[clinic end generated code: output=48214bc3d01f4dd7 input=3855f184bb3f299d]*/
1429
1430
1431 /*[clinic input]
1432 test_slice_index_converter
1433
1434 a: slice_index = 12
1435 b: slice_index(accept={int}) = 34
1436 c: slice_index(accept={int, NoneType}) = 56
1437 /
1438
1439 [clinic start generated code]*/
1440
1441 PyDoc_STRVAR(test_slice_index_converter__doc__,
1442 "test_slice_index_converter($module, a=12, b=34, c=56, /)\n"
1443 "--\n"
1444 "\n");
1445
1446 #define TEST_SLICE_INDEX_CONVERTER_METHODDEF \
1447 {"test_slice_index_converter", _PyCFunction_CAST(test_slice_index_converter), METH_FASTCALL, test_slice_index_converter__doc__},
1448
1449 static PyObject *
1450 test_slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1451 Py_ssize_t c);
1452
1453 static PyObject *
1454 test_slice_index_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1455 {
1456 PyObject *return_value = NULL;
1457 Py_ssize_t a = 12;
1458 Py_ssize_t b = 34;
1459 Py_ssize_t c = 56;
1460
1461 if (!_PyArg_CheckPositional("test_slice_index_converter", nargs, 0, 3)) {
1462 goto exit;
1463 }
1464 if (nargs < 1) {
1465 goto skip_optional;
1466 }
1467 if (!_PyEval_SliceIndex(args[0], &a)) {
1468 goto exit;
1469 }
1470 if (nargs < 2) {
1471 goto skip_optional;
1472 }
1473 if (!_PyEval_SliceIndexNotNone(args[1], &b)) {
1474 goto exit;
1475 }
1476 if (nargs < 3) {
1477 goto skip_optional;
1478 }
1479 if (!_PyEval_SliceIndex(args[2], &c)) {
1480 goto exit;
1481 }
1482 skip_optional:
1483 return_value = test_slice_index_converter_impl(module, a, b, c);
1484
1485 exit:
1486 return return_value;
1487 }
1488
1489 static PyObject *
1490 test_slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1491 Py_ssize_t c)
1492 /*[clinic end generated code: output=67506ed999361212 input=edeadb0ee126f531]*/
1493
1494
1495 /*[clinic input]
1496 test_size_t_converter
1497
1498 a: size_t = 12
1499 /
1500
1501 [clinic start generated code]*/
1502
1503 PyDoc_STRVAR(test_size_t_converter__doc__,
1504 "test_size_t_converter($module, a=12, /)\n"
1505 "--\n"
1506 "\n");
1507
1508 #define TEST_SIZE_T_CONVERTER_METHODDEF \
1509 {"test_size_t_converter", _PyCFunction_CAST(test_size_t_converter), METH_FASTCALL, test_size_t_converter__doc__},
1510
1511 static PyObject *
1512 test_size_t_converter_impl(PyObject *module, size_t a);
1513
1514 static PyObject *
1515 test_size_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1516 {
1517 PyObject *return_value = NULL;
1518 size_t a = 12;
1519
1520 if (!_PyArg_CheckPositional("test_size_t_converter", nargs, 0, 1)) {
1521 goto exit;
1522 }
1523 if (nargs < 1) {
1524 goto skip_optional;
1525 }
1526 if (!_PyLong_Size_t_Converter(args[0], &a)) {
1527 goto exit;
1528 }
1529 skip_optional:
1530 return_value = test_size_t_converter_impl(module, a);
1531
1532 exit:
1533 return return_value;
1534 }
1535
1536 static PyObject *
1537 test_size_t_converter_impl(PyObject *module, size_t a)
1538 /*[clinic end generated code: output=1653ecb5cbf775aa input=52e93a0fed0f1fb3]*/
1539
1540
1541 /*[clinic input]
1542 test_float_converter
1543
1544 a: float = 12.5
1545 /
1546
1547 [clinic start generated code]*/
1548
1549 PyDoc_STRVAR(test_float_converter__doc__,
1550 "test_float_converter($module, a=12.5, /)\n"
1551 "--\n"
1552 "\n");
1553
1554 #define TEST_FLOAT_CONVERTER_METHODDEF \
1555 {"test_float_converter", _PyCFunction_CAST(test_float_converter), METH_FASTCALL, test_float_converter__doc__},
1556
1557 static PyObject *
1558 test_float_converter_impl(PyObject *module, float a);
1559
1560 static PyObject *
1561 test_float_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1562 {
1563 PyObject *return_value = NULL;
1564 float a = 12.5;
1565
1566 if (!_PyArg_CheckPositional("test_float_converter", nargs, 0, 1)) {
1567 goto exit;
1568 }
1569 if (nargs < 1) {
1570 goto skip_optional;
1571 }
1572 if (PyFloat_CheckExact(args[0])) {
1573 a = (float) (PyFloat_AS_DOUBLE(args[0]));
1574 }
1575 else
1576 {
1577 a = (float) PyFloat_AsDouble(args[0]);
1578 if (a == -1.0 && PyErr_Occurred()) {
1579 goto exit;
1580 }
1581 }
1582 skip_optional:
1583 return_value = test_float_converter_impl(module, a);
1584
1585 exit:
1586 return return_value;
1587 }
1588
1589 static PyObject *
1590 test_float_converter_impl(PyObject *module, float a)
1591 /*[clinic end generated code: output=36ad006990a8a91e input=259c0d98eca35034]*/
1592
1593
1594 /*[clinic input]
1595 test_double_converter
1596
1597 a: double = 12.5
1598 /
1599
1600 [clinic start generated code]*/
1601
1602 PyDoc_STRVAR(test_double_converter__doc__,
1603 "test_double_converter($module, a=12.5, /)\n"
1604 "--\n"
1605 "\n");
1606
1607 #define TEST_DOUBLE_CONVERTER_METHODDEF \
1608 {"test_double_converter", _PyCFunction_CAST(test_double_converter), METH_FASTCALL, test_double_converter__doc__},
1609
1610 static PyObject *
1611 test_double_converter_impl(PyObject *module, double a);
1612
1613 static PyObject *
1614 test_double_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1615 {
1616 PyObject *return_value = NULL;
1617 double a = 12.5;
1618
1619 if (!_PyArg_CheckPositional("test_double_converter", nargs, 0, 1)) {
1620 goto exit;
1621 }
1622 if (nargs < 1) {
1623 goto skip_optional;
1624 }
1625 if (PyFloat_CheckExact(args[0])) {
1626 a = PyFloat_AS_DOUBLE(args[0]);
1627 }
1628 else
1629 {
1630 a = PyFloat_AsDouble(args[0]);
1631 if (a == -1.0 && PyErr_Occurred()) {
1632 goto exit;
1633 }
1634 }
1635 skip_optional:
1636 return_value = test_double_converter_impl(module, a);
1637
1638 exit:
1639 return return_value;
1640 }
1641
1642 static PyObject *
1643 test_double_converter_impl(PyObject *module, double a)
1644 /*[clinic end generated code: output=7435925592bac795 input=c6a9945706a41c27]*/
1645
1646
1647 /*[clinic input]
1648 test_Py_complex_converter
1649
1650 a: Py_complex
1651 /
1652
1653 [clinic start generated code]*/
1654
1655 PyDoc_STRVAR(test_Py_complex_converter__doc__,
1656 "test_Py_complex_converter($module, a, /)\n"
1657 "--\n"
1658 "\n");
1659
1660 #define TEST_PY_COMPLEX_CONVERTER_METHODDEF \
1661 {"test_Py_complex_converter", (PyCFunction)test_Py_complex_converter, METH_O, test_Py_complex_converter__doc__},
1662
1663 static PyObject *
1664 test_Py_complex_converter_impl(PyObject *module, Py_complex a);
1665
1666 static PyObject *
1667 test_Py_complex_converter(PyObject *module, PyObject *arg)
1668 {
1669 PyObject *return_value = NULL;
1670 Py_complex a;
1671
1672 a = PyComplex_AsCComplex(arg);
1673 if (PyErr_Occurred()) {
1674 goto exit;
1675 }
1676 return_value = test_Py_complex_converter_impl(module, a);
1677
1678 exit:
1679 return return_value;
1680 }
1681
1682 static PyObject *
1683 test_Py_complex_converter_impl(PyObject *module, Py_complex a)
1684 /*[clinic end generated code: output=c2ecbec2144ca540 input=070f216a515beb79]*/
1685
1686
1687 /*[clinic input]
1688 test_str_converter
1689
1690 a: str = NULL
1691 b: str = "ab"
1692 c: str(accept={str}) = "cd"
1693 d: str(accept={robuffer}) = "cef"
1694 e: str(accept={str, NoneType}) = "gh"
1695 f: str(accept={robuffer}, zeroes=True) = "ij"
1696 g: str(accept={robuffer, str}, zeroes=True) = "kl"
1697 h: str(accept={robuffer, str, NoneType}, zeroes=True) = "mn"
1698 /
1699
1700 [clinic start generated code]*/
1701
1702 PyDoc_STRVAR(test_str_converter__doc__,
1703 "test_str_converter($module, a=<unrepresentable>, b=\'ab\', c=\'cd\',\n"
1704 " d=\'cef\', e=\'gh\', f=\'ij\', g=\'kl\', h=\'mn\', /)\n"
1705 "--\n"
1706 "\n");
1707
1708 #define TEST_STR_CONVERTER_METHODDEF \
1709 {"test_str_converter", _PyCFunction_CAST(test_str_converter), METH_FASTCALL, test_str_converter__doc__},
1710
1711 static PyObject *
1712 test_str_converter_impl(PyObject *module, const char *a, const char *b,
1713 const char *c, const char *d, const char *e,
1714 const char *f, Py_ssize_t f_length, const char *g,
1715 Py_ssize_t g_length, const char *h,
1716 Py_ssize_t h_length);
1717
1718 static PyObject *
1719 test_str_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1720 {
1721 PyObject *return_value = NULL;
1722 const char *a = NULL;
1723 const char *b = "ab";
1724 const char *c = "cd";
1725 const char *d = "cef";
1726 const char *e = "gh";
1727 const char *f = "ij";
1728 Py_ssize_t f_length;
1729 const char *g = "kl";
1730 Py_ssize_t g_length;
1731 const char *h = "mn";
1732 Py_ssize_t h_length;
1733
1734 if (!_PyArg_ParseStack(args, nargs, "|sssyzy#s#z#:test_str_converter",
1735 &a, &b, &c, &d, &e, &f, &f_length, &g, &g_length, &h, &h_length)) {
1736 goto exit;
1737 }
1738 return_value = test_str_converter_impl(module, a, b, c, d, e, f, f_length, g, g_length, h, h_length);
1739
1740 exit:
1741 return return_value;
1742 }
1743
1744 static PyObject *
1745 test_str_converter_impl(PyObject *module, const char *a, const char *b,
1746 const char *c, const char *d, const char *e,
1747 const char *f, Py_ssize_t f_length, const char *g,
1748 Py_ssize_t g_length, const char *h,
1749 Py_ssize_t h_length)
1750 /*[clinic end generated code: output=82cb06d5237ef062 input=8afe9da8185cd38c]*/
1751
1752
1753 /*[clinic input]
1754 test_str_converter_encoding
1755
1756 a: str(encoding="idna")
1757 b: str(encoding="idna", accept={str})
1758 c: str(encoding="idna", accept={bytes, bytearray, str})
1759 d: str(encoding="idna", zeroes=True)
1760 e: str(encoding="idna", accept={bytes, bytearray, str}, zeroes=True)
1761 /
1762
1763 [clinic start generated code]*/
1764
1765 PyDoc_STRVAR(test_str_converter_encoding__doc__,
1766 "test_str_converter_encoding($module, a, b, c, d, e, /)\n"
1767 "--\n"
1768 "\n");
1769
1770 #define TEST_STR_CONVERTER_ENCODING_METHODDEF \
1771 {"test_str_converter_encoding", _PyCFunction_CAST(test_str_converter_encoding), METH_FASTCALL, test_str_converter_encoding__doc__},
1772
1773 static PyObject *
1774 test_str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c,
1775 char *d, Py_ssize_t d_length, char *e,
1776 Py_ssize_t e_length);
1777
1778 static PyObject *
1779 test_str_converter_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1780 {
1781 PyObject *return_value = NULL;
1782 char *a = NULL;
1783 char *b = NULL;
1784 char *c = NULL;
1785 char *d = NULL;
1786 Py_ssize_t d_length;
1787 char *e = NULL;
1788 Py_ssize_t e_length;
1789
1790 if (!_PyArg_ParseStack(args, nargs, "esesetes#et#:test_str_converter_encoding",
1791 "idna", &a, "idna", &b, "idna", &c, "idna", &d, &d_length, "idna", &e, &e_length)) {
1792 goto exit;
1793 }
1794 return_value = test_str_converter_encoding_impl(module, a, b, c, d, d_length, e, e_length);
1795 /* Post parse cleanup for a */
1796 PyMem_FREE(a);
1797 /* Post parse cleanup for b */
1798 PyMem_FREE(b);
1799 /* Post parse cleanup for c */
1800 PyMem_FREE(c);
1801 /* Post parse cleanup for d */
1802 PyMem_FREE(d);
1803 /* Post parse cleanup for e */
1804 PyMem_FREE(e);
1805
1806 exit:
1807 return return_value;
1808 }
1809
1810 static PyObject *
1811 test_str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c,
1812 char *d, Py_ssize_t d_length, char *e,
1813 Py_ssize_t e_length)
1814 /*[clinic end generated code: output=999c1deecfa15b0a input=eb4c38e1f898f402]*/
1815
1816
1817 /*[clinic input]
1818 test_Py_UNICODE_converter
1819
1820 a: Py_UNICODE
1821 b: Py_UNICODE(accept={str})
1822 c: Py_UNICODE(accept={str, NoneType})
1823 d: Py_UNICODE(zeroes=True)
1824 e: Py_UNICODE(accept={str, NoneType}, zeroes=True)
1825 /
1826
1827 [clinic start generated code]*/
1828
1829 PyDoc_STRVAR(test_Py_UNICODE_converter__doc__,
1830 "test_Py_UNICODE_converter($module, a, b, c, d, e, /)\n"
1831 "--\n"
1832 "\n");
1833
1834 #define TEST_PY_UNICODE_CONVERTER_METHODDEF \
1835 {"test_Py_UNICODE_converter", _PyCFunction_CAST(test_Py_UNICODE_converter), METH_FASTCALL, test_Py_UNICODE_converter__doc__},
1836
1837 static PyObject *
1838 test_Py_UNICODE_converter_impl(PyObject *module, const wchar_t *a,
1839 const wchar_t *b, const wchar_t *c,
1840 const wchar_t *d, Py_ssize_t d_length,
1841 const wchar_t *e, Py_ssize_t e_length);
1842
1843 static PyObject *
1844 test_Py_UNICODE_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1845 {
1846 PyObject *return_value = NULL;
1847 const wchar_t *a = NULL;
1848 const wchar_t *b = NULL;
1849 const wchar_t *c = NULL;
1850 const wchar_t *d = NULL;
1851 Py_ssize_t d_length;
1852 const wchar_t *e = NULL;
1853 Py_ssize_t e_length;
1854
1855 if (!_PyArg_ParseStack(args, nargs, "O&O&O&u#Z#:test_Py_UNICODE_converter",
1856 _PyUnicode_WideCharString_Converter, &a, _PyUnicode_WideCharString_Converter, &b, _PyUnicode_WideCharString_Opt_Converter, &c, &d, &d_length, &e, &e_length)) {
1857 goto exit;
1858 }
1859 return_value = test_Py_UNICODE_converter_impl(module, a, b, c, d, d_length, e, e_length);
1860
1861 exit:
1862 /* Cleanup for a */
1863 PyMem_Free((void *)a);
1864 /* Cleanup for b */
1865 PyMem_Free((void *)b);
1866 /* Cleanup for c */
1867 PyMem_Free((void *)c);
1868
1869 return return_value;
1870 }
1871
1872 static PyObject *
1873 test_Py_UNICODE_converter_impl(PyObject *module, const wchar_t *a,
1874 const wchar_t *b, const wchar_t *c,
1875 const wchar_t *d, Py_ssize_t d_length,
1876 const wchar_t *e, Py_ssize_t e_length)
1877 /*[clinic end generated code: output=529af9cda2a20349 input=064a3b68ad7f04b0]*/
1878
1879
1880 /*[clinic input]
1881 test_Py_buffer_converter
1882
1883 a: Py_buffer
1884 b: Py_buffer(accept={buffer})
1885 c: Py_buffer(accept={str, buffer})
1886 d: Py_buffer(accept={str, buffer, NoneType})
1887 e: Py_buffer(accept={rwbuffer})
1888 /
1889
1890 [clinic start generated code]*/
1891
1892 PyDoc_STRVAR(test_Py_buffer_converter__doc__,
1893 "test_Py_buffer_converter($module, a, b, c, d, e, /)\n"
1894 "--\n"
1895 "\n");
1896
1897 #define TEST_PY_BUFFER_CONVERTER_METHODDEF \
1898 {"test_Py_buffer_converter", _PyCFunction_CAST(test_Py_buffer_converter), METH_FASTCALL, test_Py_buffer_converter__doc__},
1899
1900 static PyObject *
1901 test_Py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b,
1902 Py_buffer *c, Py_buffer *d, Py_buffer *e);
1903
1904 static PyObject *
1905 test_Py_buffer_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1906 {
1907 PyObject *return_value = NULL;
1908 Py_buffer a = {NULL, NULL};
1909 Py_buffer b = {NULL, NULL};
1910 Py_buffer c = {NULL, NULL};
1911 Py_buffer d = {NULL, NULL};
1912 Py_buffer e = {NULL, NULL};
1913
1914 if (!_PyArg_ParseStack(args, nargs, "y*y*s*z*w*:test_Py_buffer_converter",
1915 &a, &b, &c, &d, &e)) {
1916 goto exit;
1917 }
1918 return_value = test_Py_buffer_converter_impl(module, &a, &b, &c, &d, &e);
1919
1920 exit:
1921 /* Cleanup for a */
1922 if (a.obj) {
1923 PyBuffer_Release(&a);
1924 }
1925 /* Cleanup for b */
1926 if (b.obj) {
1927 PyBuffer_Release(&b);
1928 }
1929 /* Cleanup for c */
1930 if (c.obj) {
1931 PyBuffer_Release(&c);
1932 }
1933 /* Cleanup for d */
1934 if (d.obj) {
1935 PyBuffer_Release(&d);
1936 }
1937 /* Cleanup for e */
1938 if (e.obj) {
1939 PyBuffer_Release(&e);
1940 }
1941
1942 return return_value;
1943 }
1944
1945 static PyObject *
1946 test_Py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b,
1947 Py_buffer *c, Py_buffer *d, Py_buffer *e)
1948 /*[clinic end generated code: output=a153b71b4f45f952 input=6a9da0f56f9525fd]*/
1949
1950
1951 /*[clinic input]
1952 test_keywords
1953
1954 a: object
1955 b: object
1956
1957 [clinic start generated code]*/
1958
1959 PyDoc_STRVAR(test_keywords__doc__,
1960 "test_keywords($module, /, a, b)\n"
1961 "--\n"
1962 "\n");
1963
1964 #define TEST_KEYWORDS_METHODDEF \
1965 {"test_keywords", _PyCFunction_CAST(test_keywords), METH_FASTCALL|METH_KEYWORDS, test_keywords__doc__},
1966
1967 static PyObject *
1968 test_keywords_impl(PyObject *module, PyObject *a, PyObject *b);
1969
1970 static PyObject *
1971 test_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1972 {
1973 PyObject *return_value = NULL;
1974 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1975
1976 #define NUM_KEYWORDS 2
1977 static struct {
1978 PyGC_Head _this_is_not_used;
1979 PyObject_VAR_HEAD
1980 PyObject *ob_item[NUM_KEYWORDS];
1981 } _kwtuple = {
1982 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1983 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
1984 };
1985 #undef NUM_KEYWORDS
1986 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1987
1988 #else // !Py_BUILD_CORE
1989 # define KWTUPLE NULL
1990 #endif // !Py_BUILD_CORE
1991
1992 static const char * const _keywords[] = {"a", "b", NULL};
1993 static _PyArg_Parser _parser = {
1994 .keywords = _keywords,
1995 .fname = "test_keywords",
1996 .kwtuple = KWTUPLE,
1997 };
1998 #undef KWTUPLE
1999 PyObject *argsbuf[2];
2000 PyObject *a;
2001 PyObject *b;
2002
2003 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
2004 if (!args) {
2005 goto exit;
2006 }
2007 a = args[0];
2008 b = args[1];
2009 return_value = test_keywords_impl(module, a, b);
2010
2011 exit:
2012 return return_value;
2013 }
2014
2015 static PyObject *
2016 test_keywords_impl(PyObject *module, PyObject *a, PyObject *b)
2017 /*[clinic end generated code: output=13ba007e1c842a37 input=0d3484844749c05b]*/
2018
2019
2020 /*[clinic input]
2021 test_keywords_kwonly
2022
2023 a: object
2024 *
2025 b: object
2026
2027 [clinic start generated code]*/
2028
2029 PyDoc_STRVAR(test_keywords_kwonly__doc__,
2030 "test_keywords_kwonly($module, /, a, *, b)\n"
2031 "--\n"
2032 "\n");
2033
2034 #define TEST_KEYWORDS_KWONLY_METHODDEF \
2035 {"test_keywords_kwonly", _PyCFunction_CAST(test_keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, test_keywords_kwonly__doc__},
2036
2037 static PyObject *
2038 test_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b);
2039
2040 static PyObject *
2041 test_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2042 {
2043 PyObject *return_value = NULL;
2044 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2045
2046 #define NUM_KEYWORDS 2
2047 static struct {
2048 PyGC_Head _this_is_not_used;
2049 PyObject_VAR_HEAD
2050 PyObject *ob_item[NUM_KEYWORDS];
2051 } _kwtuple = {
2052 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2053 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
2054 };
2055 #undef NUM_KEYWORDS
2056 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2057
2058 #else // !Py_BUILD_CORE
2059 # define KWTUPLE NULL
2060 #endif // !Py_BUILD_CORE
2061
2062 static const char * const _keywords[] = {"a", "b", NULL};
2063 static _PyArg_Parser _parser = {
2064 .keywords = _keywords,
2065 .fname = "test_keywords_kwonly",
2066 .kwtuple = KWTUPLE,
2067 };
2068 #undef KWTUPLE
2069 PyObject *argsbuf[2];
2070 PyObject *a;
2071 PyObject *b;
2072
2073 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2074 if (!args) {
2075 goto exit;
2076 }
2077 a = args[0];
2078 b = args[1];
2079 return_value = test_keywords_kwonly_impl(module, a, b);
2080
2081 exit:
2082 return return_value;
2083 }
2084
2085 static PyObject *
2086 test_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b)
2087 /*[clinic end generated code: output=789799a6d2d6eb4d input=384adc78bfa0bff7]*/
2088
2089
2090 /*[clinic input]
2091 test_keywords_opt
2092
2093 a: object
2094 b: object = None
2095 c: object = None
2096
2097 [clinic start generated code]*/
2098
2099 PyDoc_STRVAR(test_keywords_opt__doc__,
2100 "test_keywords_opt($module, /, a, b=None, c=None)\n"
2101 "--\n"
2102 "\n");
2103
2104 #define TEST_KEYWORDS_OPT_METHODDEF \
2105 {"test_keywords_opt", _PyCFunction_CAST(test_keywords_opt), METH_FASTCALL|METH_KEYWORDS, test_keywords_opt__doc__},
2106
2107 static PyObject *
2108 test_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2109 PyObject *c);
2110
2111 static PyObject *
2112 test_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2113 {
2114 PyObject *return_value = NULL;
2115 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2116
2117 #define NUM_KEYWORDS 3
2118 static struct {
2119 PyGC_Head _this_is_not_used;
2120 PyObject_VAR_HEAD
2121 PyObject *ob_item[NUM_KEYWORDS];
2122 } _kwtuple = {
2123 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2124 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
2125 };
2126 #undef NUM_KEYWORDS
2127 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2128
2129 #else // !Py_BUILD_CORE
2130 # define KWTUPLE NULL
2131 #endif // !Py_BUILD_CORE
2132
2133 static const char * const _keywords[] = {"a", "b", "c", NULL};
2134 static _PyArg_Parser _parser = {
2135 .keywords = _keywords,
2136 .fname = "test_keywords_opt",
2137 .kwtuple = KWTUPLE,
2138 };
2139 #undef KWTUPLE
2140 PyObject *argsbuf[3];
2141 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2142 PyObject *a;
2143 PyObject *b = Py_None;
2144 PyObject *c = Py_None;
2145
2146 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
2147 if (!args) {
2148 goto exit;
2149 }
2150 a = args[0];
2151 if (!noptargs) {
2152 goto skip_optional_pos;
2153 }
2154 if (args[1]) {
2155 b = args[1];
2156 if (!--noptargs) {
2157 goto skip_optional_pos;
2158 }
2159 }
2160 c = args[2];
2161 skip_optional_pos:
2162 return_value = test_keywords_opt_impl(module, a, b, c);
2163
2164 exit:
2165 return return_value;
2166 }
2167
2168 static PyObject *
2169 test_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2170 PyObject *c)
2171 /*[clinic end generated code: output=42430dd8ea5afde6 input=eda7964f784f4607]*/
2172
2173
2174 /*[clinic input]
2175 test_keywords_opt_kwonly
2176
2177 a: object
2178 b: object = None
2179 *
2180 c: object = None
2181 d: object = None
2182
2183 [clinic start generated code]*/
2184
2185 PyDoc_STRVAR(test_keywords_opt_kwonly__doc__,
2186 "test_keywords_opt_kwonly($module, /, a, b=None, *, c=None, d=None)\n"
2187 "--\n"
2188 "\n");
2189
2190 #define TEST_KEYWORDS_OPT_KWONLY_METHODDEF \
2191 {"test_keywords_opt_kwonly", _PyCFunction_CAST(test_keywords_opt_kwonly), METH_FASTCALL|METH_KEYWORDS, test_keywords_opt_kwonly__doc__},
2192
2193 static PyObject *
2194 test_keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2195 PyObject *c, PyObject *d);
2196
2197 static PyObject *
2198 test_keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2199 {
2200 PyObject *return_value = NULL;
2201 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2202
2203 #define NUM_KEYWORDS 4
2204 static struct {
2205 PyGC_Head _this_is_not_used;
2206 PyObject_VAR_HEAD
2207 PyObject *ob_item[NUM_KEYWORDS];
2208 } _kwtuple = {
2209 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2210 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
2211 };
2212 #undef NUM_KEYWORDS
2213 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2214
2215 #else // !Py_BUILD_CORE
2216 # define KWTUPLE NULL
2217 #endif // !Py_BUILD_CORE
2218
2219 static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
2220 static _PyArg_Parser _parser = {
2221 .keywords = _keywords,
2222 .fname = "test_keywords_opt_kwonly",
2223 .kwtuple = KWTUPLE,
2224 };
2225 #undef KWTUPLE
2226 PyObject *argsbuf[4];
2227 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2228 PyObject *a;
2229 PyObject *b = Py_None;
2230 PyObject *c = Py_None;
2231 PyObject *d = Py_None;
2232
2233 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
2234 if (!args) {
2235 goto exit;
2236 }
2237 a = args[0];
2238 if (!noptargs) {
2239 goto skip_optional_pos;
2240 }
2241 if (args[1]) {
2242 b = args[1];
2243 if (!--noptargs) {
2244 goto skip_optional_pos;
2245 }
2246 }
2247 skip_optional_pos:
2248 if (!noptargs) {
2249 goto skip_optional_kwonly;
2250 }
2251 if (args[2]) {
2252 c = args[2];
2253 if (!--noptargs) {
2254 goto skip_optional_kwonly;
2255 }
2256 }
2257 d = args[3];
2258 skip_optional_kwonly:
2259 return_value = test_keywords_opt_kwonly_impl(module, a, b, c, d);
2260
2261 exit:
2262 return return_value;
2263 }
2264
2265 static PyObject *
2266 test_keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2267 PyObject *c, PyObject *d)
2268 /*[clinic end generated code: output=f312c35c380d2bf9 input=209387a4815e5082]*/
2269
2270
2271 /*[clinic input]
2272 test_keywords_kwonly_opt
2273
2274 a: object
2275 *
2276 b: object = None
2277 c: object = None
2278
2279 [clinic start generated code]*/
2280
2281 PyDoc_STRVAR(test_keywords_kwonly_opt__doc__,
2282 "test_keywords_kwonly_opt($module, /, a, *, b=None, c=None)\n"
2283 "--\n"
2284 "\n");
2285
2286 #define TEST_KEYWORDS_KWONLY_OPT_METHODDEF \
2287 {"test_keywords_kwonly_opt", _PyCFunction_CAST(test_keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_keywords_kwonly_opt__doc__},
2288
2289 static PyObject *
2290 test_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2291 PyObject *c);
2292
2293 static PyObject *
2294 test_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2295 {
2296 PyObject *return_value = NULL;
2297 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2298
2299 #define NUM_KEYWORDS 3
2300 static struct {
2301 PyGC_Head _this_is_not_used;
2302 PyObject_VAR_HEAD
2303 PyObject *ob_item[NUM_KEYWORDS];
2304 } _kwtuple = {
2305 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2306 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
2307 };
2308 #undef NUM_KEYWORDS
2309 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2310
2311 #else // !Py_BUILD_CORE
2312 # define KWTUPLE NULL
2313 #endif // !Py_BUILD_CORE
2314
2315 static const char * const _keywords[] = {"a", "b", "c", NULL};
2316 static _PyArg_Parser _parser = {
2317 .keywords = _keywords,
2318 .fname = "test_keywords_kwonly_opt",
2319 .kwtuple = KWTUPLE,
2320 };
2321 #undef KWTUPLE
2322 PyObject *argsbuf[3];
2323 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2324 PyObject *a;
2325 PyObject *b = Py_None;
2326 PyObject *c = Py_None;
2327
2328 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
2329 if (!args) {
2330 goto exit;
2331 }
2332 a = args[0];
2333 if (!noptargs) {
2334 goto skip_optional_kwonly;
2335 }
2336 if (args[1]) {
2337 b = args[1];
2338 if (!--noptargs) {
2339 goto skip_optional_kwonly;
2340 }
2341 }
2342 c = args[2];
2343 skip_optional_kwonly:
2344 return_value = test_keywords_kwonly_opt_impl(module, a, b, c);
2345
2346 exit:
2347 return return_value;
2348 }
2349
2350 static PyObject *
2351 test_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2352 PyObject *c)
2353 /*[clinic end generated code: output=3937da2a8233ebe0 input=18393cc64fa000f4]*/
2354
2355
2356 /*[clinic input]
2357 test_posonly_keywords
2358
2359 a: object
2360 /
2361 b: object
2362
2363 [clinic start generated code]*/
2364
2365 PyDoc_STRVAR(test_posonly_keywords__doc__,
2366 "test_posonly_keywords($module, a, /, b)\n"
2367 "--\n"
2368 "\n");
2369
2370 #define TEST_POSONLY_KEYWORDS_METHODDEF \
2371 {"test_posonly_keywords", _PyCFunction_CAST(test_posonly_keywords), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords__doc__},
2372
2373 static PyObject *
2374 test_posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b);
2375
2376 static PyObject *
2377 test_posonly_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2378 {
2379 PyObject *return_value = NULL;
2380 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2381
2382 #define NUM_KEYWORDS 1
2383 static struct {
2384 PyGC_Head _this_is_not_used;
2385 PyObject_VAR_HEAD
2386 PyObject *ob_item[NUM_KEYWORDS];
2387 } _kwtuple = {
2388 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2389 .ob_item = { _Py_LATIN1_CHR('b'), },
2390 };
2391 #undef NUM_KEYWORDS
2392 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2393
2394 #else // !Py_BUILD_CORE
2395 # define KWTUPLE NULL
2396 #endif // !Py_BUILD_CORE
2397
2398 static const char * const _keywords[] = {"", "b", NULL};
2399 static _PyArg_Parser _parser = {
2400 .keywords = _keywords,
2401 .fname = "test_posonly_keywords",
2402 .kwtuple = KWTUPLE,
2403 };
2404 #undef KWTUPLE
2405 PyObject *argsbuf[2];
2406 PyObject *a;
2407 PyObject *b;
2408
2409 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
2410 if (!args) {
2411 goto exit;
2412 }
2413 a = args[0];
2414 b = args[1];
2415 return_value = test_posonly_keywords_impl(module, a, b);
2416
2417 exit:
2418 return return_value;
2419 }
2420
2421 static PyObject *
2422 test_posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b)
2423 /*[clinic end generated code: output=6b4f6dd5f4db3877 input=1767b0ebdf06060e]*/
2424
2425
2426 /*[clinic input]
2427 test_posonly_kwonly
2428
2429 a: object
2430 /
2431 *
2432 c: object
2433
2434 [clinic start generated code]*/
2435
2436 PyDoc_STRVAR(test_posonly_kwonly__doc__,
2437 "test_posonly_kwonly($module, a, /, *, c)\n"
2438 "--\n"
2439 "\n");
2440
2441 #define TEST_POSONLY_KWONLY_METHODDEF \
2442 {"test_posonly_kwonly", _PyCFunction_CAST(test_posonly_kwonly), METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly__doc__},
2443
2444 static PyObject *
2445 test_posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *c);
2446
2447 static PyObject *
2448 test_posonly_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2449 {
2450 PyObject *return_value = NULL;
2451 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2452
2453 #define NUM_KEYWORDS 1
2454 static struct {
2455 PyGC_Head _this_is_not_used;
2456 PyObject_VAR_HEAD
2457 PyObject *ob_item[NUM_KEYWORDS];
2458 } _kwtuple = {
2459 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2460 .ob_item = { _Py_LATIN1_CHR('c'), },
2461 };
2462 #undef NUM_KEYWORDS
2463 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2464
2465 #else // !Py_BUILD_CORE
2466 # define KWTUPLE NULL
2467 #endif // !Py_BUILD_CORE
2468
2469 static const char * const _keywords[] = {"", "c", NULL};
2470 static _PyArg_Parser _parser = {
2471 .keywords = _keywords,
2472 .fname = "test_posonly_kwonly",
2473 .kwtuple = KWTUPLE,
2474 };
2475 #undef KWTUPLE
2476 PyObject *argsbuf[2];
2477 PyObject *a;
2478 PyObject *c;
2479
2480 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2481 if (!args) {
2482 goto exit;
2483 }
2484 a = args[0];
2485 c = args[1];
2486 return_value = test_posonly_kwonly_impl(module, a, c);
2487
2488 exit:
2489 return return_value;
2490 }
2491
2492 static PyObject *
2493 test_posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *c)
2494 /*[clinic end generated code: output=8bef2a8198e70b26 input=9042f2818f664839]*/
2495
2496
2497 /*[clinic input]
2498 test_posonly_keywords_kwonly
2499
2500 a: object
2501 /
2502 b: object
2503 *
2504 c: object
2505
2506 [clinic start generated code]*/
2507
2508 PyDoc_STRVAR(test_posonly_keywords_kwonly__doc__,
2509 "test_posonly_keywords_kwonly($module, a, /, b, *, c)\n"
2510 "--\n"
2511 "\n");
2512
2513 #define TEST_POSONLY_KEYWORDS_KWONLY_METHODDEF \
2514 {"test_posonly_keywords_kwonly", _PyCFunction_CAST(test_posonly_keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly__doc__},
2515
2516 static PyObject *
2517 test_posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2518 PyObject *c);
2519
2520 static PyObject *
2521 test_posonly_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2522 {
2523 PyObject *return_value = NULL;
2524 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2525
2526 #define NUM_KEYWORDS 2
2527 static struct {
2528 PyGC_Head _this_is_not_used;
2529 PyObject_VAR_HEAD
2530 PyObject *ob_item[NUM_KEYWORDS];
2531 } _kwtuple = {
2532 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2533 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
2534 };
2535 #undef NUM_KEYWORDS
2536 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2537
2538 #else // !Py_BUILD_CORE
2539 # define KWTUPLE NULL
2540 #endif // !Py_BUILD_CORE
2541
2542 static const char * const _keywords[] = {"", "b", "c", NULL};
2543 static _PyArg_Parser _parser = {
2544 .keywords = _keywords,
2545 .fname = "test_posonly_keywords_kwonly",
2546 .kwtuple = KWTUPLE,
2547 };
2548 #undef KWTUPLE
2549 PyObject *argsbuf[3];
2550 PyObject *a;
2551 PyObject *b;
2552 PyObject *c;
2553
2554 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
2555 if (!args) {
2556 goto exit;
2557 }
2558 a = args[0];
2559 b = args[1];
2560 c = args[2];
2561 return_value = test_posonly_keywords_kwonly_impl(module, a, b, c);
2562
2563 exit:
2564 return return_value;
2565 }
2566
2567 static PyObject *
2568 test_posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2569 PyObject *c)
2570 /*[clinic end generated code: output=a44b8ae8300955e1 input=29546ebdca492fea]*/
2571
2572
2573 /*[clinic input]
2574 test_posonly_keywords_opt
2575
2576 a: object
2577 /
2578 b: object
2579 c: object = None
2580 d: object = None
2581
2582 [clinic start generated code]*/
2583
2584 PyDoc_STRVAR(test_posonly_keywords_opt__doc__,
2585 "test_posonly_keywords_opt($module, a, /, b, c=None, d=None)\n"
2586 "--\n"
2587 "\n");
2588
2589 #define TEST_POSONLY_KEYWORDS_OPT_METHODDEF \
2590 {"test_posonly_keywords_opt", _PyCFunction_CAST(test_posonly_keywords_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt__doc__},
2591
2592 static PyObject *
2593 test_posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2594 PyObject *c, PyObject *d);
2595
2596 static PyObject *
2597 test_posonly_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2598 {
2599 PyObject *return_value = NULL;
2600 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2601
2602 #define NUM_KEYWORDS 3
2603 static struct {
2604 PyGC_Head _this_is_not_used;
2605 PyObject_VAR_HEAD
2606 PyObject *ob_item[NUM_KEYWORDS];
2607 } _kwtuple = {
2608 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2609 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
2610 };
2611 #undef NUM_KEYWORDS
2612 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2613
2614 #else // !Py_BUILD_CORE
2615 # define KWTUPLE NULL
2616 #endif // !Py_BUILD_CORE
2617
2618 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
2619 static _PyArg_Parser _parser = {
2620 .keywords = _keywords,
2621 .fname = "test_posonly_keywords_opt",
2622 .kwtuple = KWTUPLE,
2623 };
2624 #undef KWTUPLE
2625 PyObject *argsbuf[4];
2626 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2627 PyObject *a;
2628 PyObject *b;
2629 PyObject *c = Py_None;
2630 PyObject *d = Py_None;
2631
2632 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
2633 if (!args) {
2634 goto exit;
2635 }
2636 a = args[0];
2637 b = args[1];
2638 if (!noptargs) {
2639 goto skip_optional_pos;
2640 }
2641 if (args[2]) {
2642 c = args[2];
2643 if (!--noptargs) {
2644 goto skip_optional_pos;
2645 }
2646 }
2647 d = args[3];
2648 skip_optional_pos:
2649 return_value = test_posonly_keywords_opt_impl(module, a, b, c, d);
2650
2651 exit:
2652 return return_value;
2653 }
2654
2655 static PyObject *
2656 test_posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2657 PyObject *c, PyObject *d)
2658 /*[clinic end generated code: output=cae6647c9e8e0238 input=cdf5a9625e554e9b]*/
2659
2660
2661 /*[clinic input]
2662 test_posonly_keywords_opt2
2663
2664 a: object
2665 /
2666 b: object = None
2667 c: object = None
2668
2669 [clinic start generated code]*/
2670
2671 PyDoc_STRVAR(test_posonly_keywords_opt2__doc__,
2672 "test_posonly_keywords_opt2($module, a, /, b=None, c=None)\n"
2673 "--\n"
2674 "\n");
2675
2676 #define TEST_POSONLY_KEYWORDS_OPT2_METHODDEF \
2677 {"test_posonly_keywords_opt2", _PyCFunction_CAST(test_posonly_keywords_opt2), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt2__doc__},
2678
2679 static PyObject *
2680 test_posonly_keywords_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2681 PyObject *c);
2682
2683 static PyObject *
2684 test_posonly_keywords_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2685 {
2686 PyObject *return_value = NULL;
2687 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2688
2689 #define NUM_KEYWORDS 2
2690 static struct {
2691 PyGC_Head _this_is_not_used;
2692 PyObject_VAR_HEAD
2693 PyObject *ob_item[NUM_KEYWORDS];
2694 } _kwtuple = {
2695 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2696 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
2697 };
2698 #undef NUM_KEYWORDS
2699 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2700
2701 #else // !Py_BUILD_CORE
2702 # define KWTUPLE NULL
2703 #endif // !Py_BUILD_CORE
2704
2705 static const char * const _keywords[] = {"", "b", "c", NULL};
2706 static _PyArg_Parser _parser = {
2707 .keywords = _keywords,
2708 .fname = "test_posonly_keywords_opt2",
2709 .kwtuple = KWTUPLE,
2710 };
2711 #undef KWTUPLE
2712 PyObject *argsbuf[3];
2713 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2714 PyObject *a;
2715 PyObject *b = Py_None;
2716 PyObject *c = Py_None;
2717
2718 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
2719 if (!args) {
2720 goto exit;
2721 }
2722 a = args[0];
2723 if (!noptargs) {
2724 goto skip_optional_pos;
2725 }
2726 if (args[1]) {
2727 b = args[1];
2728 if (!--noptargs) {
2729 goto skip_optional_pos;
2730 }
2731 }
2732 c = args[2];
2733 skip_optional_pos:
2734 return_value = test_posonly_keywords_opt2_impl(module, a, b, c);
2735
2736 exit:
2737 return return_value;
2738 }
2739
2740 static PyObject *
2741 test_posonly_keywords_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2742 PyObject *c)
2743 /*[clinic end generated code: output=6526fd08aafa2149 input=1581299d21d16f14]*/
2744
2745
2746 /*[clinic input]
2747 test_posonly_opt_keywords_opt
2748
2749 a: object
2750 b: object = None
2751 /
2752 c: object = None
2753 d: object = None
2754
2755 [clinic start generated code]*/
2756
2757 PyDoc_STRVAR(test_posonly_opt_keywords_opt__doc__,
2758 "test_posonly_opt_keywords_opt($module, a, b=None, /, c=None, d=None)\n"
2759 "--\n"
2760 "\n");
2761
2762 #define TEST_POSONLY_OPT_KEYWORDS_OPT_METHODDEF \
2763 {"test_posonly_opt_keywords_opt", _PyCFunction_CAST(test_posonly_opt_keywords_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_keywords_opt__doc__},
2764
2765 static PyObject *
2766 test_posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a,
2767 PyObject *b, PyObject *c, PyObject *d);
2768
2769 static PyObject *
2770 test_posonly_opt_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2771 {
2772 PyObject *return_value = NULL;
2773 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2774
2775 #define NUM_KEYWORDS 2
2776 static struct {
2777 PyGC_Head _this_is_not_used;
2778 PyObject_VAR_HEAD
2779 PyObject *ob_item[NUM_KEYWORDS];
2780 } _kwtuple = {
2781 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2782 .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
2783 };
2784 #undef NUM_KEYWORDS
2785 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2786
2787 #else // !Py_BUILD_CORE
2788 # define KWTUPLE NULL
2789 #endif // !Py_BUILD_CORE
2790
2791 static const char * const _keywords[] = {"", "", "c", "d", NULL};
2792 static _PyArg_Parser _parser = {
2793 .keywords = _keywords,
2794 .fname = "test_posonly_opt_keywords_opt",
2795 .kwtuple = KWTUPLE,
2796 };
2797 #undef KWTUPLE
2798 PyObject *argsbuf[4];
2799 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2800 PyObject *a;
2801 PyObject *b = Py_None;
2802 PyObject *c = Py_None;
2803 PyObject *d = Py_None;
2804
2805 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
2806 if (!args) {
2807 goto exit;
2808 }
2809 a = args[0];
2810 if (nargs < 2) {
2811 goto skip_optional_posonly;
2812 }
2813 noptargs--;
2814 b = args[1];
2815 skip_optional_posonly:
2816 if (!noptargs) {
2817 goto skip_optional_pos;
2818 }
2819 if (args[2]) {
2820 c = args[2];
2821 if (!--noptargs) {
2822 goto skip_optional_pos;
2823 }
2824 }
2825 d = args[3];
2826 skip_optional_pos:
2827 return_value = test_posonly_opt_keywords_opt_impl(module, a, b, c, d);
2828
2829 exit:
2830 return return_value;
2831 }
2832
2833 static PyObject *
2834 test_posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a,
2835 PyObject *b, PyObject *c, PyObject *d)
2836 /*[clinic end generated code: output=b8d01e98443738c2 input=408798ec3d42949f]*/
2837
2838
2839 /*[clinic input]
2840 test_posonly_kwonly_opt
2841
2842 a: object
2843 /
2844 *
2845 b: object
2846 c: object = None
2847 d: object = None
2848
2849 [clinic start generated code]*/
2850
2851 PyDoc_STRVAR(test_posonly_kwonly_opt__doc__,
2852 "test_posonly_kwonly_opt($module, a, /, *, b, c=None, d=None)\n"
2853 "--\n"
2854 "\n");
2855
2856 #define TEST_POSONLY_KWONLY_OPT_METHODDEF \
2857 {"test_posonly_kwonly_opt", _PyCFunction_CAST(test_posonly_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly_opt__doc__},
2858
2859 static PyObject *
2860 test_posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2861 PyObject *c, PyObject *d);
2862
2863 static PyObject *
2864 test_posonly_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2865 {
2866 PyObject *return_value = NULL;
2867 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2868
2869 #define NUM_KEYWORDS 3
2870 static struct {
2871 PyGC_Head _this_is_not_used;
2872 PyObject_VAR_HEAD
2873 PyObject *ob_item[NUM_KEYWORDS];
2874 } _kwtuple = {
2875 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2876 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
2877 };
2878 #undef NUM_KEYWORDS
2879 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2880
2881 #else // !Py_BUILD_CORE
2882 # define KWTUPLE NULL
2883 #endif // !Py_BUILD_CORE
2884
2885 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
2886 static _PyArg_Parser _parser = {
2887 .keywords = _keywords,
2888 .fname = "test_posonly_kwonly_opt",
2889 .kwtuple = KWTUPLE,
2890 };
2891 #undef KWTUPLE
2892 PyObject *argsbuf[4];
2893 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2894 PyObject *a;
2895 PyObject *b;
2896 PyObject *c = Py_None;
2897 PyObject *d = Py_None;
2898
2899 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2900 if (!args) {
2901 goto exit;
2902 }
2903 a = args[0];
2904 b = args[1];
2905 if (!noptargs) {
2906 goto skip_optional_kwonly;
2907 }
2908 if (args[2]) {
2909 c = args[2];
2910 if (!--noptargs) {
2911 goto skip_optional_kwonly;
2912 }
2913 }
2914 d = args[3];
2915 skip_optional_kwonly:
2916 return_value = test_posonly_kwonly_opt_impl(module, a, b, c, d);
2917
2918 exit:
2919 return return_value;
2920 }
2921
2922 static PyObject *
2923 test_posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2924 PyObject *c, PyObject *d)
2925 /*[clinic end generated code: output=81d71c288f13d4dc input=8d8e5643bbbc2309]*/
2926
2927
2928 /*[clinic input]
2929 test_posonly_kwonly_opt2
2930
2931 a: object
2932 /
2933 *
2934 b: object = None
2935 c: object = None
2936
2937 [clinic start generated code]*/
2938
2939 PyDoc_STRVAR(test_posonly_kwonly_opt2__doc__,
2940 "test_posonly_kwonly_opt2($module, a, /, *, b=None, c=None)\n"
2941 "--\n"
2942 "\n");
2943
2944 #define TEST_POSONLY_KWONLY_OPT2_METHODDEF \
2945 {"test_posonly_kwonly_opt2", _PyCFunction_CAST(test_posonly_kwonly_opt2), METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly_opt2__doc__},
2946
2947 static PyObject *
2948 test_posonly_kwonly_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2949 PyObject *c);
2950
2951 static PyObject *
2952 test_posonly_kwonly_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2953 {
2954 PyObject *return_value = NULL;
2955 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
2956
2957 #define NUM_KEYWORDS 2
2958 static struct {
2959 PyGC_Head _this_is_not_used;
2960 PyObject_VAR_HEAD
2961 PyObject *ob_item[NUM_KEYWORDS];
2962 } _kwtuple = {
2963 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
2964 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
2965 };
2966 #undef NUM_KEYWORDS
2967 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
2968
2969 #else // !Py_BUILD_CORE
2970 # define KWTUPLE NULL
2971 #endif // !Py_BUILD_CORE
2972
2973 static const char * const _keywords[] = {"", "b", "c", NULL};
2974 static _PyArg_Parser _parser = {
2975 .keywords = _keywords,
2976 .fname = "test_posonly_kwonly_opt2",
2977 .kwtuple = KWTUPLE,
2978 };
2979 #undef KWTUPLE
2980 PyObject *argsbuf[3];
2981 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2982 PyObject *a;
2983 PyObject *b = Py_None;
2984 PyObject *c = Py_None;
2985
2986 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
2987 if (!args) {
2988 goto exit;
2989 }
2990 a = args[0];
2991 if (!noptargs) {
2992 goto skip_optional_kwonly;
2993 }
2994 if (args[1]) {
2995 b = args[1];
2996 if (!--noptargs) {
2997 goto skip_optional_kwonly;
2998 }
2999 }
3000 c = args[2];
3001 skip_optional_kwonly:
3002 return_value = test_posonly_kwonly_opt2_impl(module, a, b, c);
3003
3004 exit:
3005 return return_value;
3006 }
3007
3008 static PyObject *
3009 test_posonly_kwonly_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
3010 PyObject *c)
3011 /*[clinic end generated code: output=a717d2a1a3310289 input=f7e5eed94f75fff0]*/
3012
3013
3014 /*[clinic input]
3015 test_posonly_opt_kwonly_opt
3016
3017 a: object
3018 b: object = None
3019 /
3020 *
3021 c: object = None
3022 d: object = None
3023
3024 [clinic start generated code]*/
3025
3026 PyDoc_STRVAR(test_posonly_opt_kwonly_opt__doc__,
3027 "test_posonly_opt_kwonly_opt($module, a, b=None, /, *, c=None, d=None)\n"
3028 "--\n"
3029 "\n");
3030
3031 #define TEST_POSONLY_OPT_KWONLY_OPT_METHODDEF \
3032 {"test_posonly_opt_kwonly_opt", _PyCFunction_CAST(test_posonly_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_kwonly_opt__doc__},
3033
3034 static PyObject *
3035 test_posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
3036 PyObject *c, PyObject *d);
3037
3038 static PyObject *
3039 test_posonly_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3040 {
3041 PyObject *return_value = NULL;
3042 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3043
3044 #define NUM_KEYWORDS 2
3045 static struct {
3046 PyGC_Head _this_is_not_used;
3047 PyObject_VAR_HEAD
3048 PyObject *ob_item[NUM_KEYWORDS];
3049 } _kwtuple = {
3050 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3051 .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
3052 };
3053 #undef NUM_KEYWORDS
3054 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3055
3056 #else // !Py_BUILD_CORE
3057 # define KWTUPLE NULL
3058 #endif // !Py_BUILD_CORE
3059
3060 static const char * const _keywords[] = {"", "", "c", "d", NULL};
3061 static _PyArg_Parser _parser = {
3062 .keywords = _keywords,
3063 .fname = "test_posonly_opt_kwonly_opt",
3064 .kwtuple = KWTUPLE,
3065 };
3066 #undef KWTUPLE
3067 PyObject *argsbuf[4];
3068 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
3069 PyObject *a;
3070 PyObject *b = Py_None;
3071 PyObject *c = Py_None;
3072 PyObject *d = Py_None;
3073
3074 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
3075 if (!args) {
3076 goto exit;
3077 }
3078 a = args[0];
3079 if (nargs < 2) {
3080 goto skip_optional_posonly;
3081 }
3082 noptargs--;
3083 b = args[1];
3084 skip_optional_posonly:
3085 if (!noptargs) {
3086 goto skip_optional_kwonly;
3087 }
3088 if (args[2]) {
3089 c = args[2];
3090 if (!--noptargs) {
3091 goto skip_optional_kwonly;
3092 }
3093 }
3094 d = args[3];
3095 skip_optional_kwonly:
3096 return_value = test_posonly_opt_kwonly_opt_impl(module, a, b, c, d);
3097
3098 exit:
3099 return return_value;
3100 }
3101
3102 static PyObject *
3103 test_posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
3104 PyObject *c, PyObject *d)
3105 /*[clinic end generated code: output=0f50b4b8d45cf2de input=1e557dc979d120fd]*/
3106
3107
3108 /*[clinic input]
3109 test_posonly_keywords_kwonly_opt
3110
3111 a: object
3112 /
3113 b: object
3114 *
3115 c: object
3116 d: object = None
3117 e: object = None
3118
3119 [clinic start generated code]*/
3120
3121 PyDoc_STRVAR(test_posonly_keywords_kwonly_opt__doc__,
3122 "test_posonly_keywords_kwonly_opt($module, a, /, b, *, c, d=None, e=None)\n"
3123 "--\n"
3124 "\n");
3125
3126 #define TEST_POSONLY_KEYWORDS_KWONLY_OPT_METHODDEF \
3127 {"test_posonly_keywords_kwonly_opt", _PyCFunction_CAST(test_posonly_keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly_opt__doc__},
3128
3129 static PyObject *
3130 test_posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a,
3131 PyObject *b, PyObject *c, PyObject *d,
3132 PyObject *e);
3133
3134 static PyObject *
3135 test_posonly_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3136 {
3137 PyObject *return_value = NULL;
3138 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3139
3140 #define NUM_KEYWORDS 4
3141 static struct {
3142 PyGC_Head _this_is_not_used;
3143 PyObject_VAR_HEAD
3144 PyObject *ob_item[NUM_KEYWORDS];
3145 } _kwtuple = {
3146 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3147 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), },
3148 };
3149 #undef NUM_KEYWORDS
3150 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3151
3152 #else // !Py_BUILD_CORE
3153 # define KWTUPLE NULL
3154 #endif // !Py_BUILD_CORE
3155
3156 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
3157 static _PyArg_Parser _parser = {
3158 .keywords = _keywords,
3159 .fname = "test_posonly_keywords_kwonly_opt",
3160 .kwtuple = KWTUPLE,
3161 };
3162 #undef KWTUPLE
3163 PyObject *argsbuf[5];
3164 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
3165 PyObject *a;
3166 PyObject *b;
3167 PyObject *c;
3168 PyObject *d = Py_None;
3169 PyObject *e = Py_None;
3170
3171 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
3172 if (!args) {
3173 goto exit;
3174 }
3175 a = args[0];
3176 b = args[1];
3177 c = args[2];
3178 if (!noptargs) {
3179 goto skip_optional_kwonly;
3180 }
3181 if (args[3]) {
3182 d = args[3];
3183 if (!--noptargs) {
3184 goto skip_optional_kwonly;
3185 }
3186 }
3187 e = args[4];
3188 skip_optional_kwonly:
3189 return_value = test_posonly_keywords_kwonly_opt_impl(module, a, b, c, d, e);
3190
3191 exit:
3192 return return_value;
3193 }
3194
3195 static PyObject *
3196 test_posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a,
3197 PyObject *b, PyObject *c, PyObject *d,
3198 PyObject *e)
3199 /*[clinic end generated code: output=8dac8d2a4e6105fa input=c3884a4f956fdc89]*/
3200
3201
3202 /*[clinic input]
3203 test_posonly_keywords_kwonly_opt2
3204
3205 a: object
3206 /
3207 b: object
3208 *
3209 c: object = None
3210 d: object = None
3211
3212 [clinic start generated code]*/
3213
3214 PyDoc_STRVAR(test_posonly_keywords_kwonly_opt2__doc__,
3215 "test_posonly_keywords_kwonly_opt2($module, a, /, b, *, c=None, d=None)\n"
3216 "--\n"
3217 "\n");
3218
3219 #define TEST_POSONLY_KEYWORDS_KWONLY_OPT2_METHODDEF \
3220 {"test_posonly_keywords_kwonly_opt2", _PyCFunction_CAST(test_posonly_keywords_kwonly_opt2), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly_opt2__doc__},
3221
3222 static PyObject *
3223 test_posonly_keywords_kwonly_opt2_impl(PyObject *module, PyObject *a,
3224 PyObject *b, PyObject *c, PyObject *d);
3225
3226 static PyObject *
3227 test_posonly_keywords_kwonly_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3228 {
3229 PyObject *return_value = NULL;
3230 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3231
3232 #define NUM_KEYWORDS 3
3233 static struct {
3234 PyGC_Head _this_is_not_used;
3235 PyObject_VAR_HEAD
3236 PyObject *ob_item[NUM_KEYWORDS];
3237 } _kwtuple = {
3238 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3239 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
3240 };
3241 #undef NUM_KEYWORDS
3242 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3243
3244 #else // !Py_BUILD_CORE
3245 # define KWTUPLE NULL
3246 #endif // !Py_BUILD_CORE
3247
3248 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
3249 static _PyArg_Parser _parser = {
3250 .keywords = _keywords,
3251 .fname = "test_posonly_keywords_kwonly_opt2",
3252 .kwtuple = KWTUPLE,
3253 };
3254 #undef KWTUPLE
3255 PyObject *argsbuf[4];
3256 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
3257 PyObject *a;
3258 PyObject *b;
3259 PyObject *c = Py_None;
3260 PyObject *d = Py_None;
3261
3262 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
3263 if (!args) {
3264 goto exit;
3265 }
3266 a = args[0];
3267 b = args[1];
3268 if (!noptargs) {
3269 goto skip_optional_kwonly;
3270 }
3271 if (args[2]) {
3272 c = args[2];
3273 if (!--noptargs) {
3274 goto skip_optional_kwonly;
3275 }
3276 }
3277 d = args[3];
3278 skip_optional_kwonly:
3279 return_value = test_posonly_keywords_kwonly_opt2_impl(module, a, b, c, d);
3280
3281 exit:
3282 return return_value;
3283 }
3284
3285 static PyObject *
3286 test_posonly_keywords_kwonly_opt2_impl(PyObject *module, PyObject *a,
3287 PyObject *b, PyObject *c, PyObject *d)
3288 /*[clinic end generated code: output=5a96d521e6414f5d input=68d01d7c0f6dafb0]*/
3289
3290
3291 /*[clinic input]
3292 test_posonly_keywords_opt_kwonly_opt
3293
3294 a: object
3295 /
3296 b: object
3297 c: object = None
3298 *
3299 d: object = None
3300 e: object = None
3301
3302 [clinic start generated code]*/
3303
3304 PyDoc_STRVAR(test_posonly_keywords_opt_kwonly_opt__doc__,
3305 "test_posonly_keywords_opt_kwonly_opt($module, a, /, b, c=None, *,\n"
3306 " d=None, e=None)\n"
3307 "--\n"
3308 "\n");
3309
3310 #define TEST_POSONLY_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
3311 {"test_posonly_keywords_opt_kwonly_opt", _PyCFunction_CAST(test_posonly_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt_kwonly_opt__doc__},
3312
3313 static PyObject *
3314 test_posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3315 PyObject *b, PyObject *c,
3316 PyObject *d, PyObject *e);
3317
3318 static PyObject *
3319 test_posonly_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3320 {
3321 PyObject *return_value = NULL;
3322 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3323
3324 #define NUM_KEYWORDS 4
3325 static struct {
3326 PyGC_Head _this_is_not_used;
3327 PyObject_VAR_HEAD
3328 PyObject *ob_item[NUM_KEYWORDS];
3329 } _kwtuple = {
3330 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3331 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), },
3332 };
3333 #undef NUM_KEYWORDS
3334 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3335
3336 #else // !Py_BUILD_CORE
3337 # define KWTUPLE NULL
3338 #endif // !Py_BUILD_CORE
3339
3340 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
3341 static _PyArg_Parser _parser = {
3342 .keywords = _keywords,
3343 .fname = "test_posonly_keywords_opt_kwonly_opt",
3344 .kwtuple = KWTUPLE,
3345 };
3346 #undef KWTUPLE
3347 PyObject *argsbuf[5];
3348 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
3349 PyObject *a;
3350 PyObject *b;
3351 PyObject *c = Py_None;
3352 PyObject *d = Py_None;
3353 PyObject *e = Py_None;
3354
3355 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
3356 if (!args) {
3357 goto exit;
3358 }
3359 a = args[0];
3360 b = args[1];
3361 if (!noptargs) {
3362 goto skip_optional_pos;
3363 }
3364 if (args[2]) {
3365 c = args[2];
3366 if (!--noptargs) {
3367 goto skip_optional_pos;
3368 }
3369 }
3370 skip_optional_pos:
3371 if (!noptargs) {
3372 goto skip_optional_kwonly;
3373 }
3374 if (args[3]) {
3375 d = args[3];
3376 if (!--noptargs) {
3377 goto skip_optional_kwonly;
3378 }
3379 }
3380 e = args[4];
3381 skip_optional_kwonly:
3382 return_value = test_posonly_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e);
3383
3384 exit:
3385 return return_value;
3386 }
3387
3388 static PyObject *
3389 test_posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3390 PyObject *b, PyObject *c,
3391 PyObject *d, PyObject *e)
3392 /*[clinic end generated code: output=d5a474dcd5dc3e9f input=d0883d45876f186c]*/
3393
3394
3395 /*[clinic input]
3396 test_posonly_keywords_opt2_kwonly_opt
3397
3398 a: object
3399 /
3400 b: object = None
3401 c: object = None
3402 *
3403 d: object = None
3404 e: object = None
3405
3406 [clinic start generated code]*/
3407
3408 PyDoc_STRVAR(test_posonly_keywords_opt2_kwonly_opt__doc__,
3409 "test_posonly_keywords_opt2_kwonly_opt($module, a, /, b=None, c=None, *,\n"
3410 " d=None, e=None)\n"
3411 "--\n"
3412 "\n");
3413
3414 #define TEST_POSONLY_KEYWORDS_OPT2_KWONLY_OPT_METHODDEF \
3415 {"test_posonly_keywords_opt2_kwonly_opt", _PyCFunction_CAST(test_posonly_keywords_opt2_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt2_kwonly_opt__doc__},
3416
3417 static PyObject *
3418 test_posonly_keywords_opt2_kwonly_opt_impl(PyObject *module, PyObject *a,
3419 PyObject *b, PyObject *c,
3420 PyObject *d, PyObject *e);
3421
3422 static PyObject *
3423 test_posonly_keywords_opt2_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3424 {
3425 PyObject *return_value = NULL;
3426 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3427
3428 #define NUM_KEYWORDS 4
3429 static struct {
3430 PyGC_Head _this_is_not_used;
3431 PyObject_VAR_HEAD
3432 PyObject *ob_item[NUM_KEYWORDS];
3433 } _kwtuple = {
3434 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3435 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), },
3436 };
3437 #undef NUM_KEYWORDS
3438 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3439
3440 #else // !Py_BUILD_CORE
3441 # define KWTUPLE NULL
3442 #endif // !Py_BUILD_CORE
3443
3444 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
3445 static _PyArg_Parser _parser = {
3446 .keywords = _keywords,
3447 .fname = "test_posonly_keywords_opt2_kwonly_opt",
3448 .kwtuple = KWTUPLE,
3449 };
3450 #undef KWTUPLE
3451 PyObject *argsbuf[5];
3452 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
3453 PyObject *a;
3454 PyObject *b = Py_None;
3455 PyObject *c = Py_None;
3456 PyObject *d = Py_None;
3457 PyObject *e = Py_None;
3458
3459 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
3460 if (!args) {
3461 goto exit;
3462 }
3463 a = args[0];
3464 if (!noptargs) {
3465 goto skip_optional_pos;
3466 }
3467 if (args[1]) {
3468 b = args[1];
3469 if (!--noptargs) {
3470 goto skip_optional_pos;
3471 }
3472 }
3473 if (args[2]) {
3474 c = args[2];
3475 if (!--noptargs) {
3476 goto skip_optional_pos;
3477 }
3478 }
3479 skip_optional_pos:
3480 if (!noptargs) {
3481 goto skip_optional_kwonly;
3482 }
3483 if (args[3]) {
3484 d = args[3];
3485 if (!--noptargs) {
3486 goto skip_optional_kwonly;
3487 }
3488 }
3489 e = args[4];
3490 skip_optional_kwonly:
3491 return_value = test_posonly_keywords_opt2_kwonly_opt_impl(module, a, b, c, d, e);
3492
3493 exit:
3494 return return_value;
3495 }
3496
3497 static PyObject *
3498 test_posonly_keywords_opt2_kwonly_opt_impl(PyObject *module, PyObject *a,
3499 PyObject *b, PyObject *c,
3500 PyObject *d, PyObject *e)
3501 /*[clinic end generated code: output=ac239c5ee8a74408 input=c95e2e1ec93035ad]*/
3502
3503
3504 /*[clinic input]
3505 test_posonly_opt_keywords_opt_kwonly_opt
3506
3507 a: object
3508 b: object = None
3509 /
3510 c: object = None
3511 d: object = None
3512 *
3513 e: object = None
3514 f: object = None
3515
3516 [clinic start generated code]*/
3517
3518 PyDoc_STRVAR(test_posonly_opt_keywords_opt_kwonly_opt__doc__,
3519 "test_posonly_opt_keywords_opt_kwonly_opt($module, a, b=None, /, c=None,\n"
3520 " d=None, *, e=None, f=None)\n"
3521 "--\n"
3522 "\n");
3523
3524 #define TEST_POSONLY_OPT_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
3525 {"test_posonly_opt_keywords_opt_kwonly_opt", _PyCFunction_CAST(test_posonly_opt_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_keywords_opt_kwonly_opt__doc__},
3526
3527 static PyObject *
3528 test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3529 PyObject *b, PyObject *c,
3530 PyObject *d, PyObject *e,
3531 PyObject *f);
3532
3533 static PyObject *
3534 test_posonly_opt_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3535 {
3536 PyObject *return_value = NULL;
3537 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3538
3539 #define NUM_KEYWORDS 4
3540 static struct {
3541 PyGC_Head _this_is_not_used;
3542 PyObject_VAR_HEAD
3543 PyObject *ob_item[NUM_KEYWORDS];
3544 } _kwtuple = {
3545 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3546 .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), _Py_LATIN1_CHR('f'), },
3547 };
3548 #undef NUM_KEYWORDS
3549 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3550
3551 #else // !Py_BUILD_CORE
3552 # define KWTUPLE NULL
3553 #endif // !Py_BUILD_CORE
3554
3555 static const char * const _keywords[] = {"", "", "c", "d", "e", "f", NULL};
3556 static _PyArg_Parser _parser = {
3557 .keywords = _keywords,
3558 .fname = "test_posonly_opt_keywords_opt_kwonly_opt",
3559 .kwtuple = KWTUPLE,
3560 };
3561 #undef KWTUPLE
3562 PyObject *argsbuf[6];
3563 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
3564 PyObject *a;
3565 PyObject *b = Py_None;
3566 PyObject *c = Py_None;
3567 PyObject *d = Py_None;
3568 PyObject *e = Py_None;
3569 PyObject *f = Py_None;
3570
3571 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
3572 if (!args) {
3573 goto exit;
3574 }
3575 a = args[0];
3576 if (nargs < 2) {
3577 goto skip_optional_posonly;
3578 }
3579 noptargs--;
3580 b = args[1];
3581 skip_optional_posonly:
3582 if (!noptargs) {
3583 goto skip_optional_pos;
3584 }
3585 if (args[2]) {
3586 c = args[2];
3587 if (!--noptargs) {
3588 goto skip_optional_pos;
3589 }
3590 }
3591 if (args[3]) {
3592 d = args[3];
3593 if (!--noptargs) {
3594 goto skip_optional_pos;
3595 }
3596 }
3597 skip_optional_pos:
3598 if (!noptargs) {
3599 goto skip_optional_kwonly;
3600 }
3601 if (args[4]) {
3602 e = args[4];
3603 if (!--noptargs) {
3604 goto skip_optional_kwonly;
3605 }
3606 }
3607 f = args[5];
3608 skip_optional_kwonly:
3609 return_value = test_posonly_opt_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e, f);
3610
3611 exit:
3612 return return_value;
3613 }
3614
3615 static PyObject *
3616 test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3617 PyObject *b, PyObject *c,
3618 PyObject *d, PyObject *e,
3619 PyObject *f)
3620 /*[clinic end generated code: output=638bbd0005639342 input=9914857713c5bbf8]*/
3621
3622 /*[clinic input]
3623 test_keyword_only_parameter
3624
3625
3626 *
3627 co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
3628
3629 [clinic start generated code]*/
3630
3631 PyDoc_STRVAR(test_keyword_only_parameter__doc__,
3632 "test_keyword_only_parameter($module, /, *, co_lnotab=None)\n"
3633 "--\n"
3634 "\n");
3635
3636 #define TEST_KEYWORD_ONLY_PARAMETER_METHODDEF \
3637 {"test_keyword_only_parameter", _PyCFunction_CAST(test_keyword_only_parameter), METH_FASTCALL|METH_KEYWORDS, test_keyword_only_parameter__doc__},
3638
3639 static PyObject *
3640 test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab);
3641
3642 static PyObject *
3643 test_keyword_only_parameter(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3644 {
3645 PyObject *return_value = NULL;
3646 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
3647
3648 #define NUM_KEYWORDS 1
3649 static struct {
3650 PyGC_Head _this_is_not_used;
3651 PyObject_VAR_HEAD
3652 PyObject *ob_item[NUM_KEYWORDS];
3653 } _kwtuple = {
3654 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
3655 .ob_item = { &_Py_ID(co_lnotab), },
3656 };
3657 #undef NUM_KEYWORDS
3658 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
3659
3660 #else // !Py_BUILD_CORE
3661 # define KWTUPLE NULL
3662 #endif // !Py_BUILD_CORE
3663
3664 static const char * const _keywords[] = {"co_lnotab", NULL};
3665 static _PyArg_Parser _parser = {
3666 .keywords = _keywords,
3667 .fname = "test_keyword_only_parameter",
3668 .kwtuple = KWTUPLE,
3669 };
3670 #undef KWTUPLE
3671 PyObject *argsbuf[1];
3672 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
3673 PyBytesObject *co_lnotab = (PyBytesObject *)self->co_lnotab;
3674
3675 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
3676 if (!args) {
3677 goto exit;
3678 }
3679 if (!noptargs) {
3680 goto skip_optional_kwonly;
3681 }
3682 if (!PyBytes_Check(args[0])) {
3683 _PyArg_BadArgument("test_keyword_only_parameter", "argument 'co_lnotab'", "bytes", args[0]);
3684 goto exit;
3685 }
3686 co_lnotab = (PyBytesObject *)args[0];
3687 skip_optional_kwonly:
3688 return_value = test_keyword_only_parameter_impl(module, co_lnotab);
3689
3690 exit:
3691 return return_value;
3692 }
3693
3694 static PyObject *
3695 test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab)
3696 /*[clinic end generated code: output=b12fe2e515a62603 input=303df5046c7e37a3]*/
3697
3698
3699 /*[clinic input]
3700 output push
3701 output preset buffer
3702 [clinic start generated code]*/
3703 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5bff3376ee0df0b5]*/
3704
3705 #ifdef CONDITION_A
3706 /*[clinic input]
3707 test_preprocessor_guarded_condition_a
3708 [clinic start generated code]*/
3709
3710 static PyObject *
3711 test_preprocessor_guarded_condition_a_impl(PyObject *module)
3712 /*[clinic end generated code: output=ad012af18085add6 input=8edb8706a98cda7e]*/
3713 #elif CONDITION_B
3714 /*[clinic input]
3715 test_preprocessor_guarded_elif_condition_b
3716 [clinic start generated code]*/
3717
3718 static PyObject *
3719 test_preprocessor_guarded_elif_condition_b_impl(PyObject *module)
3720 /*[clinic end generated code: output=615f2dee82b138d1 input=53777cebbf7fee32]*/
3721 #else
3722 /*[clinic input]
3723 test_preprocessor_guarded_else
3724 [clinic start generated code]*/
3725
3726 static PyObject *
3727 test_preprocessor_guarded_else_impl(PyObject *module)
3728 /*[clinic end generated code: output=13af7670aac51b12 input=6657ab31d74c29fc]*/
3729 #endif
3730
3731 #ifndef CONDITION_C
3732 /*[clinic input]
3733 test_preprocessor_guarded_ifndef_condition_c
3734 [clinic start generated code]*/
3735
3736 static PyObject *
3737 test_preprocessor_guarded_ifndef_condition_c_impl(PyObject *module)
3738 /*[clinic end generated code: output=ed422e8c895bb0a5 input=e9b50491cea2b668]*/
3739 #else
3740 /*[clinic input]
3741 test_preprocessor_guarded_ifndef_not_condition_c
3742 [clinic start generated code]*/
3743
3744 static PyObject *
3745 test_preprocessor_guarded_ifndef_not_condition_c_impl(PyObject *module)
3746 /*[clinic end generated code: output=de6f4c6a67f8c536 input=da74e30e01c6f2c5]*/
3747 #endif
3748
3749 #if \
3750 CONDITION_D
3751 /*[clinic input]
3752 test_preprocessor_guarded_if_with_continuation
3753 [clinic start generated code]*/
3754
3755 static PyObject *
3756 test_preprocessor_guarded_if_with_continuation_impl(PyObject *module)
3757 /*[clinic end generated code: output=3d0712ca9e2d15b9 input=4a956fd91be30284]*/
3758 #endif
3759
3760 #if CONDITION_E || CONDITION_F
3761 #warning "different type of CPP directive"
3762 /*[clinic input]
3763 test_preprocessor_guarded_if_e_or_f
3764 Makes sure cpp.Monitor handles other directives than preprocessor conditionals.
3765 [clinic start generated code]*/
3766
3767 static PyObject *
3768 test_preprocessor_guarded_if_e_or_f_impl(PyObject *module)
3769 /*[clinic end generated code: output=e49d24ff64ad88bc input=57b9c37f938bc4f1]*/
3770 #endif
3771
3772 /*[clinic input]
3773 dump buffer
3774 output pop
3775 [clinic start generated code]*/
3776
3777 #if defined(CONDITION_A)
3778
3779 PyDoc_STRVAR(test_preprocessor_guarded_condition_a__doc__,
3780 "test_preprocessor_guarded_condition_a($module, /)\n"
3781 "--\n"
3782 "\n");
3783
3784 #define TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF \
3785 {"test_preprocessor_guarded_condition_a", (PyCFunction)test_preprocessor_guarded_condition_a, METH_NOARGS, test_preprocessor_guarded_condition_a__doc__},
3786
3787 static PyObject *
3788 test_preprocessor_guarded_condition_a(PyObject *module, PyObject *Py_UNUSED(ignored))
3789 {
3790 return test_preprocessor_guarded_condition_a_impl(module);
3791 }
3792
3793 #endif /* defined(CONDITION_A) */
3794
3795 #if !defined(CONDITION_A) && (CONDITION_B)
3796
3797 PyDoc_STRVAR(test_preprocessor_guarded_elif_condition_b__doc__,
3798 "test_preprocessor_guarded_elif_condition_b($module, /)\n"
3799 "--\n"
3800 "\n");
3801
3802 #define TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF \
3803 {"test_preprocessor_guarded_elif_condition_b", (PyCFunction)test_preprocessor_guarded_elif_condition_b, METH_NOARGS, test_preprocessor_guarded_elif_condition_b__doc__},
3804
3805 static PyObject *
3806 test_preprocessor_guarded_elif_condition_b(PyObject *module, PyObject *Py_UNUSED(ignored))
3807 {
3808 return test_preprocessor_guarded_elif_condition_b_impl(module);
3809 }
3810
3811 #endif /* !defined(CONDITION_A) && (CONDITION_B) */
3812
3813 #if !defined(CONDITION_A) && !(CONDITION_B)
3814
3815 PyDoc_STRVAR(test_preprocessor_guarded_else__doc__,
3816 "test_preprocessor_guarded_else($module, /)\n"
3817 "--\n"
3818 "\n");
3819
3820 #define TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF \
3821 {"test_preprocessor_guarded_else", (PyCFunction)test_preprocessor_guarded_else, METH_NOARGS, test_preprocessor_guarded_else__doc__},
3822
3823 static PyObject *
3824 test_preprocessor_guarded_else(PyObject *module, PyObject *Py_UNUSED(ignored))
3825 {
3826 return test_preprocessor_guarded_else_impl(module);
3827 }
3828
3829 #endif /* !defined(CONDITION_A) && !(CONDITION_B) */
3830
3831 #if !defined(CONDITION_C)
3832
3833 PyDoc_STRVAR(test_preprocessor_guarded_ifndef_condition_c__doc__,
3834 "test_preprocessor_guarded_ifndef_condition_c($module, /)\n"
3835 "--\n"
3836 "\n");
3837
3838 #define TEST_PREPROCESSOR_GUARDED_IFNDEF_CONDITION_C_METHODDEF \
3839 {"test_preprocessor_guarded_ifndef_condition_c", (PyCFunction)test_preprocessor_guarded_ifndef_condition_c, METH_NOARGS, test_preprocessor_guarded_ifndef_condition_c__doc__},
3840
3841 static PyObject *
3842 test_preprocessor_guarded_ifndef_condition_c(PyObject *module, PyObject *Py_UNUSED(ignored))
3843 {
3844 return test_preprocessor_guarded_ifndef_condition_c_impl(module);
3845 }
3846
3847 #endif /* !defined(CONDITION_C) */
3848
3849 #if defined(CONDITION_C)
3850
3851 PyDoc_STRVAR(test_preprocessor_guarded_ifndef_not_condition_c__doc__,
3852 "test_preprocessor_guarded_ifndef_not_condition_c($module, /)\n"
3853 "--\n"
3854 "\n");
3855
3856 #define TEST_PREPROCESSOR_GUARDED_IFNDEF_NOT_CONDITION_C_METHODDEF \
3857 {"test_preprocessor_guarded_ifndef_not_condition_c", (PyCFunction)test_preprocessor_guarded_ifndef_not_condition_c, METH_NOARGS, test_preprocessor_guarded_ifndef_not_condition_c__doc__},
3858
3859 static PyObject *
3860 test_preprocessor_guarded_ifndef_not_condition_c(PyObject *module, PyObject *Py_UNUSED(ignored))
3861 {
3862 return test_preprocessor_guarded_ifndef_not_condition_c_impl(module);
3863 }
3864
3865 #endif /* defined(CONDITION_C) */
3866
3867 #if (CONDITION_D)
3868
3869 PyDoc_STRVAR(test_preprocessor_guarded_if_with_continuation__doc__,
3870 "test_preprocessor_guarded_if_with_continuation($module, /)\n"
3871 "--\n"
3872 "\n");
3873
3874 #define TEST_PREPROCESSOR_GUARDED_IF_WITH_CONTINUATION_METHODDEF \
3875 {"test_preprocessor_guarded_if_with_continuation", (PyCFunction)test_preprocessor_guarded_if_with_continuation, METH_NOARGS, test_preprocessor_guarded_if_with_continuation__doc__},
3876
3877 static PyObject *
3878 test_preprocessor_guarded_if_with_continuation(PyObject *module, PyObject *Py_UNUSED(ignored))
3879 {
3880 return test_preprocessor_guarded_if_with_continuation_impl(module);
3881 }
3882
3883 #endif /* (CONDITION_D) */
3884
3885 #if (CONDITION_E || CONDITION_F)
3886
3887 PyDoc_STRVAR(test_preprocessor_guarded_if_e_or_f__doc__,
3888 "test_preprocessor_guarded_if_e_or_f($module, /)\n"
3889 "--\n"
3890 "\n"
3891 "Makes sure cpp.Monitor handles other directives than preprocessor conditionals.");
3892
3893 #define TEST_PREPROCESSOR_GUARDED_IF_E_OR_F_METHODDEF \
3894 {"test_preprocessor_guarded_if_e_or_f", (PyCFunction)test_preprocessor_guarded_if_e_or_f, METH_NOARGS, test_preprocessor_guarded_if_e_or_f__doc__},
3895
3896 static PyObject *
3897 test_preprocessor_guarded_if_e_or_f(PyObject *module, PyObject *Py_UNUSED(ignored))
3898 {
3899 return test_preprocessor_guarded_if_e_or_f_impl(module);
3900 }
3901
3902 #endif /* (CONDITION_E || CONDITION_F) */
3903
3904 #ifndef TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
3905 #define TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
3906 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF) */
3907
3908 #ifndef TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF
3909 #define TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF
3910 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF) */
3911
3912 #ifndef TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF
3913 #define TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF
3914 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF) */
3915
3916 #ifndef TEST_PREPROCESSOR_GUARDED_IFNDEF_CONDITION_C_METHODDEF
3917 #define TEST_PREPROCESSOR_GUARDED_IFNDEF_CONDITION_C_METHODDEF
3918 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_IFNDEF_CONDITION_C_METHODDEF) */
3919
3920 #ifndef TEST_PREPROCESSOR_GUARDED_IFNDEF_NOT_CONDITION_C_METHODDEF
3921 #define TEST_PREPROCESSOR_GUARDED_IFNDEF_NOT_CONDITION_C_METHODDEF
3922 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_IFNDEF_NOT_CONDITION_C_METHODDEF) */
3923
3924 #ifndef TEST_PREPROCESSOR_GUARDED_IF_WITH_CONTINUATION_METHODDEF
3925 #define TEST_PREPROCESSOR_GUARDED_IF_WITH_CONTINUATION_METHODDEF
3926 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_IF_WITH_CONTINUATION_METHODDEF) */
3927
3928 #ifndef TEST_PREPROCESSOR_GUARDED_IF_E_OR_F_METHODDEF
3929 #define TEST_PREPROCESSOR_GUARDED_IF_E_OR_F_METHODDEF
3930 #endif /* !defined(TEST_PREPROCESSOR_GUARDED_IF_E_OR_F_METHODDEF) */
3931 /*[clinic end generated code: output=fcfae7cac7a99e62 input=3fc80c9989d2f2e1]*/
3932
3933 /*[clinic input]
3934 test_vararg_and_posonly
3935
3936
3937 a: object
3938 /
3939 *args: object
3940
3941 [clinic start generated code]*/
3942
3943 PyDoc_STRVAR(test_vararg_and_posonly__doc__,
3944 "test_vararg_and_posonly($module, a, /, *args)\n"
3945 "--\n"
3946 "\n");
3947
3948 #define TEST_VARARG_AND_POSONLY_METHODDEF \
3949 {"test_vararg_and_posonly", _PyCFunction_CAST(test_vararg_and_posonly), METH_FASTCALL, test_vararg_and_posonly__doc__},
3950
3951 static PyObject *
3952 test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args);
3953
3954 static PyObject *
3955 test_vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
3956 {
3957 PyObject *return_value = NULL;
3958 PyObject *a;
3959 PyObject *__clinic_args = NULL;
3960
3961 if (!_PyArg_CheckPositional("test_vararg_and_posonly", nargs, 1, PY_SSIZE_T_MAX)) {
3962 goto exit;
3963 }
3964 a = args[0];
3965 __clinic_args = PyTuple_New(nargs - 1);
3966 if (!__clinic_args) {
3967 goto exit;
3968 }
3969 for (Py_ssize_t i = 0; i < nargs - 1; ++i) {
3970 PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[1 + i]));
3971 }
3972 return_value = test_vararg_and_posonly_impl(module, a, __clinic_args);
3973
3974 exit:
3975 Py_XDECREF(__clinic_args);
3976 return return_value;
3977 }
3978
3979 static PyObject *
3980 test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
3981 /*[clinic end generated code: output=79b75dc07decc8d6 input=9cfa748bbff09877]*/
3982
3983 /*[clinic input]
3984 test_vararg
3985
3986
3987 a: object
3988 *args: object
3989
3990 [clinic start generated code]*/
3991
3992 PyDoc_STRVAR(test_vararg__doc__,
3993 "test_vararg($module, /, a, *args)\n"
3994 "--\n"
3995 "\n");
3996
3997 #define TEST_VARARG_METHODDEF \
3998 {"test_vararg", _PyCFunction_CAST(test_vararg), METH_FASTCALL|METH_KEYWORDS, test_vararg__doc__},
3999
4000 static PyObject *
4001 test_vararg_impl(PyObject *module, PyObject *a, PyObject *args);
4002
4003 static PyObject *
4004 test_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4005 {
4006 PyObject *return_value = NULL;
4007 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4008
4009 #define NUM_KEYWORDS 1
4010 static struct {
4011 PyGC_Head _this_is_not_used;
4012 PyObject_VAR_HEAD
4013 PyObject *ob_item[NUM_KEYWORDS];
4014 } _kwtuple = {
4015 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4016 .ob_item = { _Py_LATIN1_CHR('a'), },
4017 };
4018 #undef NUM_KEYWORDS
4019 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4020
4021 #else // !Py_BUILD_CORE
4022 # define KWTUPLE NULL
4023 #endif // !Py_BUILD_CORE
4024
4025 static const char * const _keywords[] = {"a", NULL};
4026 static _PyArg_Parser _parser = {
4027 .keywords = _keywords,
4028 .fname = "test_vararg",
4029 .kwtuple = KWTUPLE,
4030 };
4031 #undef KWTUPLE
4032 PyObject *argsbuf[2];
4033 PyObject *a;
4034 PyObject *__clinic_args = NULL;
4035
4036 args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
4037 if (!args) {
4038 goto exit;
4039 }
4040 a = args[0];
4041 __clinic_args = args[1];
4042 return_value = test_vararg_impl(module, a, __clinic_args);
4043
4044 exit:
4045 Py_XDECREF(__clinic_args);
4046 return return_value;
4047 }
4048
4049 static PyObject *
4050 test_vararg_impl(PyObject *module, PyObject *a, PyObject *args)
4051 /*[clinic end generated code: output=1411e464f358a7ba input=81d33815ad1bae6e]*/
4052
4053 /*[clinic input]
4054 test_vararg_with_default
4055
4056
4057 a: object
4058 *args: object
4059 b: bool = False
4060
4061 [clinic start generated code]*/
4062
4063 PyDoc_STRVAR(test_vararg_with_default__doc__,
4064 "test_vararg_with_default($module, /, a, *args, b=False)\n"
4065 "--\n"
4066 "\n");
4067
4068 #define TEST_VARARG_WITH_DEFAULT_METHODDEF \
4069 {"test_vararg_with_default", _PyCFunction_CAST(test_vararg_with_default), METH_FASTCALL|METH_KEYWORDS, test_vararg_with_default__doc__},
4070
4071 static PyObject *
4072 test_vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
4073 int b);
4074
4075 static PyObject *
4076 test_vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4077 {
4078 PyObject *return_value = NULL;
4079 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4080
4081 #define NUM_KEYWORDS 2
4082 static struct {
4083 PyGC_Head _this_is_not_used;
4084 PyObject_VAR_HEAD
4085 PyObject *ob_item[NUM_KEYWORDS];
4086 } _kwtuple = {
4087 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4088 .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
4089 };
4090 #undef NUM_KEYWORDS
4091 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4092
4093 #else // !Py_BUILD_CORE
4094 # define KWTUPLE NULL
4095 #endif // !Py_BUILD_CORE
4096
4097 static const char * const _keywords[] = {"a", "b", NULL};
4098 static _PyArg_Parser _parser = {
4099 .keywords = _keywords,
4100 .fname = "test_vararg_with_default",
4101 .kwtuple = KWTUPLE,
4102 };
4103 #undef KWTUPLE
4104 PyObject *argsbuf[3];
4105 Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
4106 PyObject *a;
4107 PyObject *__clinic_args = NULL;
4108 int b = 0;
4109
4110 args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
4111 if (!args) {
4112 goto exit;
4113 }
4114 a = args[0];
4115 __clinic_args = args[1];
4116 if (!noptargs) {
4117 goto skip_optional_kwonly;
4118 }
4119 b = PyObject_IsTrue(args[2]);
4120 if (b < 0) {
4121 goto exit;
4122 }
4123 skip_optional_kwonly:
4124 return_value = test_vararg_with_default_impl(module, a, __clinic_args, b);
4125
4126 exit:
4127 Py_XDECREF(__clinic_args);
4128 return return_value;
4129 }
4130
4131 static PyObject *
4132 test_vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
4133 int b)
4134 /*[clinic end generated code: output=f09d4b917063ca41 input=6e110b54acd9b22d]*/
4135
4136 /*[clinic input]
4137 test_vararg_with_only_defaults
4138
4139
4140 *args: object
4141 b: bool = False
4142 c: object = ' '
4143
4144 [clinic start generated code]*/
4145
4146 PyDoc_STRVAR(test_vararg_with_only_defaults__doc__,
4147 "test_vararg_with_only_defaults($module, /, *args, b=False, c=\' \')\n"
4148 "--\n"
4149 "\n");
4150
4151 #define TEST_VARARG_WITH_ONLY_DEFAULTS_METHODDEF \
4152 {"test_vararg_with_only_defaults", _PyCFunction_CAST(test_vararg_with_only_defaults), METH_FASTCALL|METH_KEYWORDS, test_vararg_with_only_defaults__doc__},
4153
4154 static PyObject *
4155 test_vararg_with_only_defaults_impl(PyObject *module, PyObject *args, int b,
4156 PyObject *c);
4157
4158 static PyObject *
4159 test_vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4160 {
4161 PyObject *return_value = NULL;
4162 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4163
4164 #define NUM_KEYWORDS 2
4165 static struct {
4166 PyGC_Head _this_is_not_used;
4167 PyObject_VAR_HEAD
4168 PyObject *ob_item[NUM_KEYWORDS];
4169 } _kwtuple = {
4170 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4171 .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
4172 };
4173 #undef NUM_KEYWORDS
4174 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4175
4176 #else // !Py_BUILD_CORE
4177 # define KWTUPLE NULL
4178 #endif // !Py_BUILD_CORE
4179
4180 static const char * const _keywords[] = {"b", "c", NULL};
4181 static _PyArg_Parser _parser = {
4182 .keywords = _keywords,
4183 .fname = "test_vararg_with_only_defaults",
4184 .kwtuple = KWTUPLE,
4185 };
4186 #undef KWTUPLE
4187 PyObject *argsbuf[3];
4188 Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
4189 PyObject *__clinic_args = NULL;
4190 int b = 0;
4191 PyObject *c = " ";
4192
4193 args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, 0, argsbuf);
4194 if (!args) {
4195 goto exit;
4196 }
4197 __clinic_args = args[0];
4198 if (!noptargs) {
4199 goto skip_optional_kwonly;
4200 }
4201 if (args[1]) {
4202 b = PyObject_IsTrue(args[1]);
4203 if (b < 0) {
4204 goto exit;
4205 }
4206 if (!--noptargs) {
4207 goto skip_optional_kwonly;
4208 }
4209 }
4210 c = args[2];
4211 skip_optional_kwonly:
4212 return_value = test_vararg_with_only_defaults_impl(module, __clinic_args, b, c);
4213
4214 exit:
4215 Py_XDECREF(__clinic_args);
4216 return return_value;
4217 }
4218
4219 static PyObject *
4220 test_vararg_with_only_defaults_impl(PyObject *module, PyObject *args, int b,
4221 PyObject *c)
4222 /*[clinic end generated code: output=cc6590b8805d5433 input=fa56a709a035666e]*/
4223
4224 /*[clinic input]
4225 test_paramname_module
4226
4227 module as mod: object
4228 [clinic start generated code]*/
4229
4230 PyDoc_STRVAR(test_paramname_module__doc__,
4231 "test_paramname_module($module, /, module)\n"
4232 "--\n"
4233 "\n");
4234
4235 #define TEST_PARAMNAME_MODULE_METHODDEF \
4236 {"test_paramname_module", _PyCFunction_CAST(test_paramname_module), METH_FASTCALL|METH_KEYWORDS, test_paramname_module__doc__},
4237
4238 static PyObject *
4239 test_paramname_module_impl(PyObject *module, PyObject *mod);
4240
4241 static PyObject *
4242 test_paramname_module(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4243 {
4244 PyObject *return_value = NULL;
4245 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4246
4247 #define NUM_KEYWORDS 1
4248 static struct {
4249 PyGC_Head _this_is_not_used;
4250 PyObject_VAR_HEAD
4251 PyObject *ob_item[NUM_KEYWORDS];
4252 } _kwtuple = {
4253 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4254 .ob_item = { &_Py_ID(module), },
4255 };
4256 #undef NUM_KEYWORDS
4257 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4258
4259 #else // !Py_BUILD_CORE
4260 # define KWTUPLE NULL
4261 #endif // !Py_BUILD_CORE
4262
4263 static const char * const _keywords[] = {"module", NULL};
4264 static _PyArg_Parser _parser = {
4265 .keywords = _keywords,
4266 .fname = "test_paramname_module",
4267 .kwtuple = KWTUPLE,
4268 };
4269 #undef KWTUPLE
4270 PyObject *argsbuf[1];
4271 PyObject *mod;
4272
4273 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
4274 if (!args) {
4275 goto exit;
4276 }
4277 mod = args[0];
4278 return_value = test_paramname_module_impl(module, mod);
4279
4280 exit:
4281 return return_value;
4282 }
4283
4284 static PyObject *
4285 test_paramname_module_impl(PyObject *module, PyObject *mod)
4286 /*[clinic end generated code: output=4a2a849ecbcc8b53 input=afefe259667f13ba]*/
4287
4288 /*[clinic input]
4289 mangle1
4290
4291 args: object
4292 kwnames: object
4293 return_value: object
4294 _keywords: object
4295 _parser: object
4296 argsbuf: object
4297 fastargs: object
4298 nargs: object
4299 noptargs: object
4300
4301 [clinic start generated code]*/
4302
4303 PyDoc_STRVAR(mangle1__doc__,
4304 "mangle1($module, /, args, kwnames, return_value, _keywords, _parser,\n"
4305 " argsbuf, fastargs, nargs, noptargs)\n"
4306 "--\n"
4307 "\n");
4308
4309 #define MANGLE1_METHODDEF \
4310 {"mangle1", _PyCFunction_CAST(mangle1), METH_FASTCALL|METH_KEYWORDS, mangle1__doc__},
4311
4312 static PyObject *
4313 mangle1_impl(PyObject *module, PyObject *args, PyObject *kwnames,
4314 PyObject *return_value, PyObject *_keywords, PyObject *_parser,
4315 PyObject *argsbuf, PyObject *fastargs, PyObject *nargs,
4316 PyObject *noptargs);
4317
4318 static PyObject *
4319 mangle1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4320 {
4321 PyObject *return_value = NULL;
4322 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4323
4324 #define NUM_KEYWORDS 9
4325 static struct {
4326 PyGC_Head _this_is_not_used;
4327 PyObject_VAR_HEAD
4328 PyObject *ob_item[NUM_KEYWORDS];
4329 } _kwtuple = {
4330 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4331 .ob_item = { &_Py_ID(args), &_Py_ID(kwnames), &_Py_ID(return_value), &_Py_ID(_keywords), &_Py_ID(_parser), &_Py_ID(argsbuf), &_Py_ID(fastargs), &_Py_ID(nargs), &_Py_ID(noptargs), },
4332 };
4333 #undef NUM_KEYWORDS
4334 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4335
4336 #else // !Py_BUILD_CORE
4337 # define KWTUPLE NULL
4338 #endif // !Py_BUILD_CORE
4339
4340 static const char * const _keywords[] = {"args", "kwnames", "return_value", "_keywords", "_parser", "argsbuf", "fastargs", "nargs", "noptargs", NULL};
4341 static _PyArg_Parser _parser = {
4342 .keywords = _keywords,
4343 .fname = "mangle1",
4344 .kwtuple = KWTUPLE,
4345 };
4346 #undef KWTUPLE
4347 PyObject *argsbuf[9];
4348 PyObject *__clinic_args;
4349 PyObject *__clinic_kwnames;
4350 PyObject *__clinic_return_value;
4351 PyObject *__clinic__keywords;
4352 PyObject *__clinic__parser;
4353 PyObject *__clinic_argsbuf;
4354 PyObject *__clinic_fastargs;
4355 PyObject *__clinic_nargs;
4356 PyObject *__clinic_noptargs;
4357
4358 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 9, 9, 0, argsbuf);
4359 if (!args) {
4360 goto exit;
4361 }
4362 __clinic_args = args[0];
4363 __clinic_kwnames = args[1];
4364 __clinic_return_value = args[2];
4365 __clinic__keywords = args[3];
4366 __clinic__parser = args[4];
4367 __clinic_argsbuf = args[5];
4368 __clinic_fastargs = args[6];
4369 __clinic_nargs = args[7];
4370 __clinic_noptargs = args[8];
4371 return_value = mangle1_impl(module, __clinic_args, __clinic_kwnames, __clinic_return_value, __clinic__keywords, __clinic__parser, __clinic_argsbuf, __clinic_fastargs, __clinic_nargs, __clinic_noptargs);
4372
4373 exit:
4374 return return_value;
4375 }
4376
4377 static PyObject *
4378 mangle1_impl(PyObject *module, PyObject *args, PyObject *kwnames,
4379 PyObject *return_value, PyObject *_keywords, PyObject *_parser,
4380 PyObject *argsbuf, PyObject *fastargs, PyObject *nargs,
4381 PyObject *noptargs)
4382 /*[clinic end generated code: output=083e5076be9987c3 input=a3ed51bdedf8a3c7]*/
4383
4384 /*[clinic input]
4385 mangle2
4386
4387 args: object
4388 kwargs: object
4389 return_value: object
4390
4391 [clinic start generated code]*/
4392
4393 PyDoc_STRVAR(mangle2__doc__,
4394 "mangle2($module, /, args, kwargs, return_value)\n"
4395 "--\n"
4396 "\n");
4397
4398 #define MANGLE2_METHODDEF \
4399 {"mangle2", _PyCFunction_CAST(mangle2), METH_FASTCALL|METH_KEYWORDS, mangle2__doc__},
4400
4401 static PyObject *
4402 mangle2_impl(PyObject *module, PyObject *args, PyObject *kwargs,
4403 PyObject *return_value);
4404
4405 static PyObject *
4406 mangle2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4407 {
4408 PyObject *return_value = NULL;
4409 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4410
4411 #define NUM_KEYWORDS 3
4412 static struct {
4413 PyGC_Head _this_is_not_used;
4414 PyObject_VAR_HEAD
4415 PyObject *ob_item[NUM_KEYWORDS];
4416 } _kwtuple = {
4417 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4418 .ob_item = { &_Py_ID(args), &_Py_ID(kwargs), &_Py_ID(return_value), },
4419 };
4420 #undef NUM_KEYWORDS
4421 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4422
4423 #else // !Py_BUILD_CORE
4424 # define KWTUPLE NULL
4425 #endif // !Py_BUILD_CORE
4426
4427 static const char * const _keywords[] = {"args", "kwargs", "return_value", NULL};
4428 static _PyArg_Parser _parser = {
4429 .keywords = _keywords,
4430 .fname = "mangle2",
4431 .kwtuple = KWTUPLE,
4432 };
4433 #undef KWTUPLE
4434 PyObject *argsbuf[3];
4435 PyObject *__clinic_args;
4436 PyObject *__clinic_kwargs;
4437 PyObject *__clinic_return_value;
4438
4439 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
4440 if (!args) {
4441 goto exit;
4442 }
4443 __clinic_args = args[0];
4444 __clinic_kwargs = args[1];
4445 __clinic_return_value = args[2];
4446 return_value = mangle2_impl(module, __clinic_args, __clinic_kwargs, __clinic_return_value);
4447
4448 exit:
4449 return return_value;
4450 }
4451
4452 static PyObject *
4453 mangle2_impl(PyObject *module, PyObject *args, PyObject *kwargs,
4454 PyObject *return_value)
4455 /*[clinic end generated code: output=2ebb62aaefe7590a input=391766fee51bad7a]*/
4456
4457
4458 /*[clinic input]
4459 Test.cls_with_param
4460 cls: defining_class
4461 /
4462 a: int
4463 [clinic start generated code]*/
4464
4465 PyDoc_STRVAR(Test_cls_with_param__doc__,
4466 "cls_with_param($self, /, a)\n"
4467 "--\n"
4468 "\n");
4469
4470 #define TEST_CLS_WITH_PARAM_METHODDEF \
4471 {"cls_with_param", _PyCFunction_CAST(Test_cls_with_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, Test_cls_with_param__doc__},
4472
4473 static PyObject *
4474 Test_cls_with_param_impl(TestObj *self, PyTypeObject *cls, int a);
4475
4476 static PyObject *
4477 Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4478 {
4479 PyObject *return_value = NULL;
4480 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4481
4482 #define NUM_KEYWORDS 1
4483 static struct {
4484 PyGC_Head _this_is_not_used;
4485 PyObject_VAR_HEAD
4486 PyObject *ob_item[NUM_KEYWORDS];
4487 } _kwtuple = {
4488 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4489 .ob_item = { _Py_LATIN1_CHR('a'), },
4490 };
4491 #undef NUM_KEYWORDS
4492 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4493
4494 #else // !Py_BUILD_CORE
4495 # define KWTUPLE NULL
4496 #endif // !Py_BUILD_CORE
4497
4498 static const char * const _keywords[] = {"a", NULL};
4499 static _PyArg_Parser _parser = {
4500 .keywords = _keywords,
4501 .fname = "cls_with_param",
4502 .kwtuple = KWTUPLE,
4503 };
4504 #undef KWTUPLE
4505 PyObject *argsbuf[1];
4506 int a;
4507
4508 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
4509 if (!args) {
4510 goto exit;
4511 }
4512 a = PyLong_AsInt(args[0]);
4513 if (a == -1 && PyErr_Occurred()) {
4514 goto exit;
4515 }
4516 return_value = Test_cls_with_param_impl(self, cls, a);
4517
4518 exit:
4519 return return_value;
4520 }
4521
4522 static PyObject *
4523 Test_cls_with_param_impl(TestObj *self, PyTypeObject *cls, int a)
4524 /*[clinic end generated code: output=a3a968137b0f320a input=af158077bd237ef9]*/
4525
4526
4527 /*[clinic input]
4528 Test.__init__
4529 Empty init method.
4530 [clinic start generated code]*/
4531
4532 PyDoc_STRVAR(Test___init____doc__,
4533 "Test()\n"
4534 "--\n"
4535 "\n"
4536 "Empty init method.");
4537
4538 static int
4539 Test___init___impl(TestObj *self);
4540
4541 static int
4542 Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
4543 {
4544 int return_value = -1;
4545 PyTypeObject *base_tp = TestType;
4546
4547 if ((Py_IS_TYPE(self, base_tp) ||
4548 Py_TYPE(self)->tp_new == base_tp->tp_new) &&
4549 !_PyArg_NoPositional("Test", args)) {
4550 goto exit;
4551 }
4552 if ((Py_IS_TYPE(self, base_tp) ||
4553 Py_TYPE(self)->tp_new == base_tp->tp_new) &&
4554 !_PyArg_NoKeywords("Test", kwargs)) {
4555 goto exit;
4556 }
4557 return_value = Test___init___impl((TestObj *)self);
4558
4559 exit:
4560 return return_value;
4561 }
4562
4563 static int
4564 Test___init___impl(TestObj *self)
4565 /*[clinic end generated code: output=f6a35c85bc5b408f input=4ea79fee54d0c3ff]*/
4566
4567
4568 /*[clinic input]
4569 @classmethod
4570 Test.__new__
4571 Empty new method.
4572 [clinic start generated code]*/
4573
4574 PyDoc_STRVAR(Test__doc__,
4575 "Test()\n"
4576 "--\n"
4577 "\n"
4578 "Empty new method.");
4579
4580 static PyObject *
4581 Test_impl(PyTypeObject *type);
4582
4583 static PyObject *
4584 Test(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4585 {
4586 PyObject *return_value = NULL;
4587 PyTypeObject *base_tp = TestType;
4588
4589 if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
4590 !_PyArg_NoPositional("Test", args)) {
4591 goto exit;
4592 }
4593 if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
4594 !_PyArg_NoKeywords("Test", kwargs)) {
4595 goto exit;
4596 }
4597 return_value = Test_impl(type);
4598
4599 exit:
4600 return return_value;
4601 }
4602
4603 static PyObject *
4604 Test_impl(PyTypeObject *type)
4605 /*[clinic end generated code: output=68a117adc057940f input=6fe98a19f097907f]*/
4606
4607
4608 /*[clinic input]
4609 Test.cls_no_params
4610 cls: defining_class
4611 /
4612 [clinic start generated code]*/
4613
4614 PyDoc_STRVAR(Test_cls_no_params__doc__,
4615 "cls_no_params($self, /)\n"
4616 "--\n"
4617 "\n");
4618
4619 #define TEST_CLS_NO_PARAMS_METHODDEF \
4620 {"cls_no_params", _PyCFunction_CAST(Test_cls_no_params), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, Test_cls_no_params__doc__},
4621
4622 static PyObject *
4623 Test_cls_no_params_impl(TestObj *self, PyTypeObject *cls);
4624
4625 static PyObject *
4626 Test_cls_no_params(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
4627 {
4628 if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
4629 PyErr_SetString(PyExc_TypeError, "cls_no_params() takes no arguments");
4630 return NULL;
4631 }
4632 return Test_cls_no_params_impl(self, cls);
4633 }
4634
4635 static PyObject *
4636 Test_cls_no_params_impl(TestObj *self, PyTypeObject *cls)
4637 /*[clinic end generated code: output=4d68b4652c144af3 input=e7e2e4e344e96a11]*/
4638
4639
4640 /*[clinic input]
4641 Test.metho_not_default_return_converter -> int
4642 a: object
4643 /
4644 [clinic start generated code]*/
4645
4646 PyDoc_STRVAR(Test_metho_not_default_return_converter__doc__,
4647 "metho_not_default_return_converter($self, a, /)\n"
4648 "--\n"
4649 "\n");
4650
4651 #define TEST_METHO_NOT_DEFAULT_RETURN_CONVERTER_METHODDEF \
4652 {"metho_not_default_return_converter", (PyCFunction)Test_metho_not_default_return_converter, METH_O, Test_metho_not_default_return_converter__doc__},
4653
4654 static int
4655 Test_metho_not_default_return_converter_impl(TestObj *self, PyObject *a);
4656
4657 static PyObject *
4658 Test_metho_not_default_return_converter(TestObj *self, PyObject *a)
4659 {
4660 PyObject *return_value = NULL;
4661 int _return_value;
4662
4663 _return_value = Test_metho_not_default_return_converter_impl(self, a);
4664 if ((_return_value == -1) && PyErr_Occurred()) {
4665 goto exit;
4666 }
4667 return_value = PyLong_FromLong((long)_return_value);
4668
4669 exit:
4670 return return_value;
4671 }
4672
4673 static int
4674 Test_metho_not_default_return_converter_impl(TestObj *self, PyObject *a)
4675 /*[clinic end generated code: output=3350de11bd538007 input=428657129b521177]*/
4676
4677
4678 /*[clinic input]
4679 Test.an_metho_arg_named_arg
4680 arg: int
4681 Name should be mangled to 'arg_' in generated output.
4682 /
4683 [clinic start generated code]*/
4684
4685 PyDoc_STRVAR(Test_an_metho_arg_named_arg__doc__,
4686 "an_metho_arg_named_arg($self, arg, /)\n"
4687 "--\n"
4688 "\n"
4689 "\n"
4690 "\n"
4691 " arg\n"
4692 " Name should be mangled to \'arg_\' in generated output.");
4693
4694 #define TEST_AN_METHO_ARG_NAMED_ARG_METHODDEF \
4695 {"an_metho_arg_named_arg", (PyCFunction)Test_an_metho_arg_named_arg, METH_O, Test_an_metho_arg_named_arg__doc__},
4696
4697 static PyObject *
4698 Test_an_metho_arg_named_arg_impl(TestObj *self, int arg);
4699
4700 static PyObject *
4701 Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
4702 {
4703 PyObject *return_value = NULL;
4704 int arg;
4705
4706 arg = PyLong_AsInt(arg_);
4707 if (arg == -1 && PyErr_Occurred()) {
4708 goto exit;
4709 }
4710 return_value = Test_an_metho_arg_named_arg_impl(self, arg);
4711
4712 exit:
4713 return return_value;
4714 }
4715
4716 static PyObject *
4717 Test_an_metho_arg_named_arg_impl(TestObj *self, int arg)
4718 /*[clinic end generated code: output=9f04de4a62287e28 input=2a53a57cf5624f95]*/
4719
4720
4721 /*[clinic input]
4722 Test.__init__
4723 *args: object
4724
4725 Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.
4726 [clinic start generated code]*/
4727
4728 PyDoc_STRVAR(Test___init____doc__,
4729 "Test(*args)\n"
4730 "--\n"
4731 "\n"
4732 "Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.");
4733
4734 static int
4735 Test___init___impl(TestObj *self, PyObject *args);
4736
4737 static int
4738 Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
4739 {
4740 int return_value = -1;
4741 PyTypeObject *base_tp = TestType;
4742 PyObject *__clinic_args = NULL;
4743
4744 if ((Py_IS_TYPE(self, base_tp) ||
4745 Py_TYPE(self)->tp_new == base_tp->tp_new) &&
4746 !_PyArg_NoKeywords("Test", kwargs)) {
4747 goto exit;
4748 }
4749 if (!_PyArg_CheckPositional("Test", PyTuple_GET_SIZE(args), 0, PY_SSIZE_T_MAX)) {
4750 goto exit;
4751 }
4752 __clinic_args = PyTuple_GetSlice(0, -1);
4753 return_value = Test___init___impl((TestObj *)self, __clinic_args);
4754
4755 exit:
4756 Py_XDECREF(__clinic_args);
4757 return return_value;
4758 }
4759
4760 static int
4761 Test___init___impl(TestObj *self, PyObject *args)
4762 /*[clinic end generated code: output=0ed1009fe0dcf98d input=2a8bd0033c9ac772]*/
4763
4764
4765 /*[clinic input]
4766 @classmethod
4767 Test.__new__
4768 *args: object
4769
4770 Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.
4771 [clinic start generated code]*/
4772
4773 PyDoc_STRVAR(Test__doc__,
4774 "Test(*args)\n"
4775 "--\n"
4776 "\n"
4777 "Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.");
4778
4779 static PyObject *
4780 Test_impl(PyTypeObject *type, PyObject *args);
4781
4782 static PyObject *
4783 Test(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4784 {
4785 PyObject *return_value = NULL;
4786 PyTypeObject *base_tp = TestType;
4787 PyObject *__clinic_args = NULL;
4788
4789 if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
4790 !_PyArg_NoKeywords("Test", kwargs)) {
4791 goto exit;
4792 }
4793 if (!_PyArg_CheckPositional("Test", PyTuple_GET_SIZE(args), 0, PY_SSIZE_T_MAX)) {
4794 goto exit;
4795 }
4796 __clinic_args = PyTuple_GetSlice(0, -1);
4797 return_value = Test_impl(type, __clinic_args);
4798
4799 exit:
4800 Py_XDECREF(__clinic_args);
4801 return return_value;
4802 }
4803
4804 static PyObject *
4805 Test_impl(PyTypeObject *type, PyObject *args)
4806 /*[clinic end generated code: output=8b219f6633e2a2e9 input=70ad829df3dd9b84]*/
4807
4808
4809 /*[clinic input]
4810 Test.__init__
4811 a: object
4812 Init method with positional or keyword arguments.
4813 [clinic start generated code]*/
4814
4815 PyDoc_STRVAR(Test___init____doc__,
4816 "Test(a)\n"
4817 "--\n"
4818 "\n"
4819 "Init method with positional or keyword arguments.");
4820
4821 static int
4822 Test___init___impl(TestObj *self, PyObject *a);
4823
4824 static int
4825 Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
4826 {
4827 int return_value = -1;
4828 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
4829
4830 #define NUM_KEYWORDS 1
4831 static struct {
4832 PyGC_Head _this_is_not_used;
4833 PyObject_VAR_HEAD
4834 PyObject *ob_item[NUM_KEYWORDS];
4835 } _kwtuple = {
4836 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
4837 .ob_item = { _Py_LATIN1_CHR('a'), },
4838 };
4839 #undef NUM_KEYWORDS
4840 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
4841
4842 #else // !Py_BUILD_CORE
4843 # define KWTUPLE NULL
4844 #endif // !Py_BUILD_CORE
4845
4846 static const char * const _keywords[] = {"a", NULL};
4847 static _PyArg_Parser _parser = {
4848 .keywords = _keywords,
4849 .fname = "Test",
4850 .kwtuple = KWTUPLE,
4851 };
4852 #undef KWTUPLE
4853 PyObject *argsbuf[1];
4854 PyObject * const *fastargs;
4855 Py_ssize_t nargs = PyTuple_GET_SIZE(args);
4856 PyObject *a;
4857
4858 fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
4859 if (!fastargs) {
4860 goto exit;
4861 }
4862 a = fastargs[0];
4863 return_value = Test___init___impl((TestObj *)self, a);
4864
4865 exit:
4866 return return_value;
4867 }
4868
4869 static int
4870 Test___init___impl(TestObj *self, PyObject *a)
4871 /*[clinic end generated code: output=0e1239b9bc247bc1 input=a8f9222a6ab35c59]*/
4872
4873
4874 /*[clinic input]
4875 @classmethod
4876 Test.class_method
4877 [clinic start generated code]*/
4878
4879 PyDoc_STRVAR(Test_class_method__doc__,
4880 "class_method($type, /)\n"
4881 "--\n"
4882 "\n");
4883
4884 #define TEST_CLASS_METHOD_METHODDEF \
4885 {"class_method", (PyCFunction)Test_class_method, METH_NOARGS|METH_CLASS, Test_class_method__doc__},
4886
4887 static PyObject *
4888 Test_class_method_impl(PyTypeObject *type);
4889
4890 static PyObject *
4891 Test_class_method(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
4892 {
4893 return Test_class_method_impl(type);
4894 }
4895
4896 static PyObject *
4897 Test_class_method_impl(PyTypeObject *type)
4898 /*[clinic end generated code: output=47fb7ecca1abcaaa input=43bc4a0494547b80]*/
4899
4900
4901 /*[clinic input]
4902 @staticmethod
4903 Test.static_method
4904 [clinic start generated code]*/
4905
4906 PyDoc_STRVAR(Test_static_method__doc__,
4907 "static_method()\n"
4908 "--\n"
4909 "\n");
4910
4911 #define TEST_STATIC_METHOD_METHODDEF \
4912 {"static_method", (PyCFunction)Test_static_method, METH_NOARGS|METH_STATIC, Test_static_method__doc__},
4913
4914 static PyObject *
4915 Test_static_method_impl();
4916
4917 static PyObject *
4918 Test_static_method(void *null, PyObject *Py_UNUSED(ignored))
4919 {
4920 return Test_static_method_impl();
4921 }
4922
4923 static PyObject *
4924 Test_static_method_impl()
4925 /*[clinic end generated code: output=82524a63025cf7ab input=dae892fac55ae72b]*/
4926
4927
4928 /*[clinic input]
4929 @coexist
4930 Test.meth_coexist
4931 [clinic start generated code]*/
4932
4933 PyDoc_STRVAR(Test_meth_coexist__doc__,
4934 "meth_coexist($self, /)\n"
4935 "--\n"
4936 "\n");
4937
4938 #define TEST_METH_COEXIST_METHODDEF \
4939 {"meth_coexist", (PyCFunction)Test_meth_coexist, METH_NOARGS|METH_COEXIST, Test_meth_coexist__doc__},
4940
4941 static PyObject *
4942 Test_meth_coexist_impl(TestObj *self);
4943
4944 static PyObject *
4945 Test_meth_coexist(TestObj *self, PyObject *Py_UNUSED(ignored))
4946 {
4947 return Test_meth_coexist_impl(self);
4948 }
4949
4950 static PyObject *
4951 Test_meth_coexist_impl(TestObj *self)
4952 /*[clinic end generated code: output=808a293d0cd27439 input=2a1d75b5e6fec6dd]*/
4953
4954 /*[clinic input]
4955 @getter
4956 Test.property
4957 [clinic start generated code]*/
4958
4959 #if !defined(Test_property_DOCSTR)
4960 # define Test_property_DOCSTR NULL
4961 #endif
4962 #if defined(TEST_PROPERTY_GETSETDEF)
4963 # undef TEST_PROPERTY_GETSETDEF
4964 # define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, (setter)Test_property_set, Test_property_DOCSTR},
4965 #else
4966 # define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, NULL, Test_property_DOCSTR},
4967 #endif
4968
4969 static PyObject *
4970 Test_property_get_impl(TestObj *self);
4971
4972 static PyObject *
4973 Test_property_get(TestObj *self, void *Py_UNUSED(context))
4974 {
4975 return Test_property_get_impl(self);
4976 }
4977
4978 static PyObject *
4979 Test_property_get_impl(TestObj *self)
4980 /*[clinic end generated code: output=7cadd0f539805266 input=2d92b3449fbc7d2b]*/
4981
4982 /*[clinic input]
4983 @setter
4984 Test.property
4985 [clinic start generated code]*/
4986
4987 #if !defined(Test_property_DOCSTR)
4988 # define Test_property_DOCSTR NULL
4989 #endif
4990 #if defined(TEST_PROPERTY_GETSETDEF)
4991 # undef TEST_PROPERTY_GETSETDEF
4992 # define TEST_PROPERTY_GETSETDEF {"property", (getter)Test_property_get, (setter)Test_property_set, Test_property_DOCSTR},
4993 #else
4994 # define TEST_PROPERTY_GETSETDEF {"property", NULL, (setter)Test_property_set, NULL},
4995 #endif
4996
4997 static int
4998 Test_property_set_impl(TestObj *self, PyObject *value);
4999
5000 static int
5001 Test_property_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
5002 {
5003 int return_value;
5004
5005 return_value = Test_property_set_impl(self, value);
5006
5007 return return_value;
5008 }
5009
5010 static int
5011 Test_property_set_impl(TestObj *self, PyObject *value)
5012 /*[clinic end generated code: output=e4342fe9bb1d7817 input=3bc3f46a23c83a88]*/
5013
5014 /*[clinic input]
5015 @setter
5016 Test.setter_first_with_docstr
5017 [clinic start generated code]*/
5018
5019 #if !defined(Test_setter_first_with_docstr_DOCSTR)
5020 # define Test_setter_first_with_docstr_DOCSTR NULL
5021 #endif
5022 #if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
5023 # undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
5024 # define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
5025 #else
5026 # define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", NULL, (setter)Test_setter_first_with_docstr_set, NULL},
5027 #endif
5028
5029 static int
5030 Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value);
5031
5032 static int
5033 Test_setter_first_with_docstr_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
5034 {
5035 int return_value;
5036
5037 return_value = Test_setter_first_with_docstr_set_impl(self, value);
5038
5039 return return_value;
5040 }
5041
5042 static int
5043 Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value)
5044 /*[clinic end generated code: output=e4d76b558a4061db input=31a045ce11bbe961]*/
5045
5046 /*[clinic input]
5047 @getter
5048 Test.setter_first_with_docstr
5049
5050 my silly docstring
5051 [clinic start generated code]*/
5052
5053 PyDoc_STRVAR(Test_setter_first_with_docstr__doc__,
5054 "my silly docstring");
5055 #if defined(Test_setter_first_with_docstr_DOCSTR)
5056 # undef Test_setter_first_with_docstr_DOCSTR
5057 #endif
5058 #define Test_setter_first_with_docstr_DOCSTR Test_setter_first_with_docstr__doc__
5059
5060 #if !defined(Test_setter_first_with_docstr_DOCSTR)
5061 # define Test_setter_first_with_docstr_DOCSTR NULL
5062 #endif
5063 #if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
5064 # undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
5065 # define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
5066 #else
5067 # define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, NULL, Test_setter_first_with_docstr_DOCSTR},
5068 #endif
5069
5070 static PyObject *
5071 Test_setter_first_with_docstr_get_impl(TestObj *self);
5072
5073 static PyObject *
5074 Test_setter_first_with_docstr_get(TestObj *self, void *Py_UNUSED(context))
5075 {
5076 return Test_setter_first_with_docstr_get_impl(self);
5077 }
5078
5079 static PyObject *
5080 Test_setter_first_with_docstr_get_impl(TestObj *self)
5081 /*[clinic end generated code: output=749a30266f9fb443 input=10af4e43b3cb34dc]*/
5082
5083 /*[clinic input]
5084 output push
5085 output preset buffer
5086 [clinic start generated code]*/
5087 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5bff3376ee0df0b5]*/
5088
5089 /*[clinic input]
5090 buffer_clear
5091 a: int
5092 We'll call 'destination buffer clear' after this.
5093
5094 Argument Clinic's buffer preset puts most generated code into the
5095 'buffer' destination, except from 'impl_definition', which is put into
5096 the 'block' destination, so we should expect everything but
5097 'impl_definition' to be cleared.
5098 [clinic start generated code]*/
5099
5100 static PyObject *
5101 buffer_clear_impl(PyObject *module, int a)
5102 /*[clinic end generated code: output=f14bba74677e1846 input=a4c308a6fdab043c]*/
5103
5104 /*[clinic input]
5105 destination buffer clear
5106 output pop
5107 [clinic start generated code]*/
5108 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f20d06adb8252084]*/
5109
5110
5111 /*[clinic input]
5112 output push
5113 destination test1 new buffer
5114 output everything suppress
5115 output docstring_definition test1
5116 [clinic start generated code]*/
5117 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5a77c454970992fc]*/
5118
5119 /*[clinic input]
5120 new_dest
5121 a: int
5122 Only this docstring should be outputted to test1.
5123 [clinic start generated code]*/
5124 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=da5af421ed8996ed]*/
5125
5126 /*[clinic input]
5127 dump test1
5128 output pop
5129 [clinic start generated code]*/
5130
5131 PyDoc_STRVAR(new_dest__doc__,
5132 "new_dest($module, /, a)\n"
5133 "--\n"
5134 "\n"
5135 "Only this docstring should be outputted to test1.");
5136 /*[clinic end generated code: output=9cac703f51d90e84 input=090db8df4945576d]*/
5137
5138
5139 /*[clinic input]
5140 mangled_c_keyword_identifier
5141 i as int: int
5142 The 'int' param should be mangled as 'int_value'
5143 [clinic start generated code]*/
5144
5145 PyDoc_STRVAR(mangled_c_keyword_identifier__doc__,
5146 "mangled_c_keyword_identifier($module, /, i)\n"
5147 "--\n"
5148 "\n"
5149 "The \'int\' param should be mangled as \'int_value\'");
5150
5151 #define MANGLED_C_KEYWORD_IDENTIFIER_METHODDEF \
5152 {"mangled_c_keyword_identifier", _PyCFunction_CAST(mangled_c_keyword_identifier), METH_FASTCALL|METH_KEYWORDS, mangled_c_keyword_identifier__doc__},
5153
5154 static PyObject *
5155 mangled_c_keyword_identifier_impl(PyObject *module, int int_value);
5156
5157 static PyObject *
5158 mangled_c_keyword_identifier(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
5159 {
5160 PyObject *return_value = NULL;
5161 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
5162
5163 #define NUM_KEYWORDS 1
5164 static struct {
5165 PyGC_Head _this_is_not_used;
5166 PyObject_VAR_HEAD
5167 PyObject *ob_item[NUM_KEYWORDS];
5168 } _kwtuple = {
5169 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
5170 .ob_item = { _Py_LATIN1_CHR('i'), },
5171 };
5172 #undef NUM_KEYWORDS
5173 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
5174
5175 #else // !Py_BUILD_CORE
5176 # define KWTUPLE NULL
5177 #endif // !Py_BUILD_CORE
5178
5179 static const char * const _keywords[] = {"i", NULL};
5180 static _PyArg_Parser _parser = {
5181 .keywords = _keywords,
5182 .fname = "mangled_c_keyword_identifier",
5183 .kwtuple = KWTUPLE,
5184 };
5185 #undef KWTUPLE
5186 PyObject *argsbuf[1];
5187 int int_value;
5188
5189 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
5190 if (!args) {
5191 goto exit;
5192 }
5193 int_value = PyLong_AsInt(args[0]);
5194 if (int_value == -1 && PyErr_Occurred()) {
5195 goto exit;
5196 }
5197 return_value = mangled_c_keyword_identifier_impl(module, int_value);
5198
5199 exit:
5200 return return_value;
5201 }
5202
5203 static PyObject *
5204 mangled_c_keyword_identifier_impl(PyObject *module, int int_value)
5205 /*[clinic end generated code: output=01a8088b57632916 input=060876448ab567a2]*/
5206
5207
5208 /*[clinic input]
5209 bool_return -> bool
5210 [clinic start generated code]*/
5211
5212 PyDoc_STRVAR(bool_return__doc__,
5213 "bool_return($module, /)\n"
5214 "--\n"
5215 "\n");
5216
5217 #define BOOL_RETURN_METHODDEF \
5218 {"bool_return", (PyCFunction)bool_return, METH_NOARGS, bool_return__doc__},
5219
5220 static int
5221 bool_return_impl(PyObject *module);
5222
5223 static PyObject *
5224 bool_return(PyObject *module, PyObject *Py_UNUSED(ignored))
5225 {
5226 PyObject *return_value = NULL;
5227 int _return_value;
5228
5229 _return_value = bool_return_impl(module);
5230 if ((_return_value == -1) && PyErr_Occurred()) {
5231 goto exit;
5232 }
5233 return_value = PyBool_FromLong((long)_return_value);
5234
5235 exit:
5236 return return_value;
5237 }
5238
5239 static int
5240 bool_return_impl(PyObject *module)
5241 /*[clinic end generated code: output=3a65f07830e48e98 input=93ba95d39ee98f39]*/
5242
5243
5244 /*[clinic input]
5245 double_return -> double
5246 [clinic start generated code]*/
5247
5248 PyDoc_STRVAR(double_return__doc__,
5249 "double_return($module, /)\n"
5250 "--\n"
5251 "\n");
5252
5253 #define DOUBLE_RETURN_METHODDEF \
5254 {"double_return", (PyCFunction)double_return, METH_NOARGS, double_return__doc__},
5255
5256 static double
5257 double_return_impl(PyObject *module);
5258
5259 static PyObject *
5260 double_return(PyObject *module, PyObject *Py_UNUSED(ignored))
5261 {
5262 PyObject *return_value = NULL;
5263 double _return_value;
5264
5265 _return_value = double_return_impl(module);
5266 if ((_return_value == -1.0) && PyErr_Occurred()) {
5267 goto exit;
5268 }
5269 return_value = PyFloat_FromDouble(_return_value);
5270
5271 exit:
5272 return return_value;
5273 }
5274
5275 static double
5276 double_return_impl(PyObject *module)
5277 /*[clinic end generated code: output=076dc72595d3f66d input=da11b6255e4cbfd7]*/
5278
5279
5280 /*[clinic input]
5281 Test.__init__
5282 a: object
5283 [
5284 b: object
5285 ]
5286 /
5287 Should generate two PyArg_ParseTuple calls.
5288 [clinic start generated code]*/
5289
5290 PyDoc_STRVAR(Test___init____doc__,
5291 "Test(a, [b])\n"
5292 "Should generate two PyArg_ParseTuple calls.");
5293
5294 static int
5295 Test___init___impl(TestObj *self, PyObject *a, int group_right_1,
5296 PyObject *b);
5297
5298 static int
5299 Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
5300 {
5301 int return_value = -1;
5302 PyTypeObject *base_tp = TestType;
5303 PyObject *a;
5304 int group_right_1 = 0;
5305 PyObject *b = NULL;
5306
5307 if ((Py_IS_TYPE(self, base_tp) ||
5308 Py_TYPE(self)->tp_new == base_tp->tp_new) &&
5309 !_PyArg_NoKeywords("Test", kwargs)) {
5310 goto exit;
5311 }
5312 switch (PyTuple_GET_SIZE(args)) {
5313 case 1:
5314 if (!PyArg_ParseTuple(args, "O:__init__", &a)) {
5315 goto exit;
5316 }
5317 break;
5318 case 2:
5319 if (!PyArg_ParseTuple(args, "OO:__init__", &a, &b)) {
5320 goto exit;
5321 }
5322 group_right_1 = 1;
5323 break;
5324 default:
5325 PyErr_SetString(PyExc_TypeError, "Test.__init__ requires 1 to 2 arguments");
5326 goto exit;
5327 }
5328 return_value = Test___init___impl((TestObj *)self, a, group_right_1, b);
5329
5330 exit:
5331 return return_value;
5332 }
5333
5334 static int
5335 Test___init___impl(TestObj *self, PyObject *a, int group_right_1,
5336 PyObject *b)
5337 /*[clinic end generated code: output=2bbb8ea60e8f57a6 input=10f5d0f1e8e466ef]*/
5338
5339
5340 /*[clinic input]
5341 Test._pyarg_parsestackandkeywords
5342 cls: defining_class
5343 key: str(accept={str, robuffer}, zeroes=True)
5344 /
5345 Check that _PyArg_ParseStackAndKeywords() is generated.
5346 [clinic start generated code]*/
5347
5348 PyDoc_STRVAR(Test__pyarg_parsestackandkeywords__doc__,
5349 "_pyarg_parsestackandkeywords($self, key, /)\n"
5350 "--\n"
5351 "\n"
5352 "Check that _PyArg_ParseStackAndKeywords() is generated.");
5353
5354 #define TEST__PYARG_PARSESTACKANDKEYWORDS_METHODDEF \
5355 {"_pyarg_parsestackandkeywords", _PyCFunction_CAST(Test__pyarg_parsestackandkeywords), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, Test__pyarg_parsestackandkeywords__doc__},
5356
5357 static PyObject *
5358 Test__pyarg_parsestackandkeywords_impl(TestObj *self, PyTypeObject *cls,
5359 const char *key,
5360 Py_ssize_t key_length);
5361
5362 static PyObject *
5363 Test__pyarg_parsestackandkeywords(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
5364 {
5365 PyObject *return_value = NULL;
5366 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
5367 # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
5368 #else
5369 # define KWTUPLE NULL
5370 #endif
5371
5372 static const char * const _keywords[] = {"", NULL};
5373 static _PyArg_Parser _parser = {
5374 .keywords = _keywords,
5375 .format = "s#:_pyarg_parsestackandkeywords",
5376 .kwtuple = KWTUPLE,
5377 };
5378 #undef KWTUPLE
5379 const char *key;
5380 Py_ssize_t key_length;
5381
5382 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
5383 &key, &key_length)) {
5384 goto exit;
5385 }
5386 return_value = Test__pyarg_parsestackandkeywords_impl(self, cls, key, key_length);
5387
5388 exit:
5389 return return_value;
5390 }
5391
5392 static PyObject *
5393 Test__pyarg_parsestackandkeywords_impl(TestObj *self, PyTypeObject *cls,
5394 const char *key,
5395 Py_ssize_t key_length)
5396 /*[clinic end generated code: output=4fda8a7f2547137c input=fc72ef4b4cfafabc]*/
5397
5398
5399 /*[clinic input]
5400 fn_with_default_binop_expr
5401 arg: object(c_default='CONST_A + CONST_B') = a+b
5402 [clinic start generated code]*/
5403
5404 PyDoc_STRVAR(fn_with_default_binop_expr__doc__,
5405 "fn_with_default_binop_expr($module, /, arg=a+b)\n"
5406 "--\n"
5407 "\n");
5408
5409 #define FN_WITH_DEFAULT_BINOP_EXPR_METHODDEF \
5410 {"fn_with_default_binop_expr", _PyCFunction_CAST(fn_with_default_binop_expr), METH_FASTCALL|METH_KEYWORDS, fn_with_default_binop_expr__doc__},
5411
5412 static PyObject *
5413 fn_with_default_binop_expr_impl(PyObject *module, PyObject *arg);
5414
5415 static PyObject *
5416 fn_with_default_binop_expr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
5417 {
5418 PyObject *return_value = NULL;
5419 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
5420
5421 #define NUM_KEYWORDS 1
5422 static struct {
5423 PyGC_Head _this_is_not_used;
5424 PyObject_VAR_HEAD
5425 PyObject *ob_item[NUM_KEYWORDS];
5426 } _kwtuple = {
5427 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
5428 .ob_item = { &_Py_ID(arg), },
5429 };
5430 #undef NUM_KEYWORDS
5431 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
5432
5433 #else // !Py_BUILD_CORE
5434 # define KWTUPLE NULL
5435 #endif // !Py_BUILD_CORE
5436
5437 static const char * const _keywords[] = {"arg", NULL};
5438 static _PyArg_Parser _parser = {
5439 .keywords = _keywords,
5440 .fname = "fn_with_default_binop_expr",
5441 .kwtuple = KWTUPLE,
5442 };
5443 #undef KWTUPLE
5444 PyObject *argsbuf[1];
5445 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
5446 PyObject *arg = CONST_A + CONST_B;
5447
5448 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
5449 if (!args) {
5450 goto exit;
5451 }
5452 if (!noptargs) {
5453 goto skip_optional_pos;
5454 }
5455 arg = args[0];
5456 skip_optional_pos:
5457 return_value = fn_with_default_binop_expr_impl(module, arg);
5458
5459 exit:
5460 return return_value;
5461 }
5462
5463 static PyObject *
5464 fn_with_default_binop_expr_impl(PyObject *module, PyObject *arg)
5465 /*[clinic end generated code: output=018672772e4092ff input=1b55c8ae68d89453]*/
5466
5467
5468 /*[python input]
5469 class Custom_converter(CConverter):
5470 type = "str"
5471 default = "Hello!"
5472 converter = "c_converter_func"
5473 [python start generated code]*/
5474 /*[python end generated code: output=da39a3ee5e6b4b0d input=d612708f0efb8e3c]*/
5475
5476 /*[clinic input]
5477 docstr_fallback_to_converter_default
5478 a: Custom
5479 Check docstring default value fallback.
5480
5481 Verify that the docstring formatter fetches the default
5482 value from the converter if no 'py_default' is found.
5483 The signature should have the default a='Hello!',
5484 as given by the Custom converter.
5485 [clinic start generated code]*/
5486
5487 PyDoc_STRVAR(docstr_fallback_to_converter_default__doc__,
5488 "docstr_fallback_to_converter_default($module, /, a=\'Hello!\')\n"
5489 "--\n"
5490 "\n"
5491 "Check docstring default value fallback.\n"
5492 "\n"
5493 "Verify that the docstring formatter fetches the default\n"
5494 "value from the converter if no \'py_default\' is found.\n"
5495 "The signature should have the default a=\'Hello!\',\n"
5496 "as given by the Custom converter.");
5497
5498 #define DOCSTR_FALLBACK_TO_CONVERTER_DEFAULT_METHODDEF \
5499 {"docstr_fallback_to_converter_default", _PyCFunction_CAST(docstr_fallback_to_converter_default), METH_FASTCALL|METH_KEYWORDS, docstr_fallback_to_converter_default__doc__},
5500
5501 static PyObject *
5502 docstr_fallback_to_converter_default_impl(PyObject *module, str a);
5503
5504 static PyObject *
5505 docstr_fallback_to_converter_default(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
5506 {
5507 PyObject *return_value = NULL;
5508 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
5509
5510 #define NUM_KEYWORDS 1
5511 static struct {
5512 PyGC_Head _this_is_not_used;
5513 PyObject_VAR_HEAD
5514 PyObject *ob_item[NUM_KEYWORDS];
5515 } _kwtuple = {
5516 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
5517 .ob_item = { _Py_LATIN1_CHR('a'), },
5518 };
5519 #undef NUM_KEYWORDS
5520 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
5521
5522 #else // !Py_BUILD_CORE
5523 # define KWTUPLE NULL
5524 #endif // !Py_BUILD_CORE
5525
5526 static const char * const _keywords[] = {"a", NULL};
5527 static _PyArg_Parser _parser = {
5528 .keywords = _keywords,
5529 .fname = "docstr_fallback_to_converter_default",
5530 .kwtuple = KWTUPLE,
5531 };
5532 #undef KWTUPLE
5533 PyObject *argsbuf[1];
5534 str a;
5535
5536 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
5537 if (!args) {
5538 goto exit;
5539 }
5540 if (!c_converter_func(args[0], &a)) {
5541 goto exit;
5542 }
5543 return_value = docstr_fallback_to_converter_default_impl(module, a);
5544
5545 exit:
5546 return return_value;
5547 }
5548
5549 static PyObject *
5550 docstr_fallback_to_converter_default_impl(PyObject *module, str a)
5551 /*[clinic end generated code: output=3fff7b702f0065cb input=0cbe6a4d24bc2274]*/
5552
5553
5554 /*[clinic input]
5555 @critical_section
5556 test_critical_section
5557 [clinic start generated code]*/
5558
5559 PyDoc_STRVAR(test_critical_section__doc__,
5560 "test_critical_section($module, /)\n"
5561 "--\n"
5562 "\n");
5563
5564 #define TEST_CRITICAL_SECTION_METHODDEF \
5565 {"test_critical_section", (PyCFunction)test_critical_section, METH_NOARGS, test_critical_section__doc__},
5566
5567 static PyObject *
5568 test_critical_section_impl(PyObject *module);
5569
5570 static PyObject *
5571 test_critical_section(PyObject *module, PyObject *Py_UNUSED(ignored))
5572 {
5573 PyObject *return_value = NULL;
5574
5575 Py_BEGIN_CRITICAL_SECTION(module);
5576 return_value = test_critical_section_impl(module);
5577 Py_END_CRITICAL_SECTION();
5578
5579 return return_value;
5580 }
5581
5582 static PyObject *
5583 test_critical_section_impl(PyObject *module)
5584 /*[clinic end generated code: output=9d5a87bb28aa3f0c input=8c58956d6ff00f80]*/
5585
5586
5587 /*[clinic input]
5588 @critical_section
5589 test_critical_section_meth_o
5590 a: object(subclass_of="&PyUnicode_Type")
5591 /
5592 [clinic start generated code]*/
5593
5594 PyDoc_STRVAR(test_critical_section_meth_o__doc__,
5595 "test_critical_section_meth_o($module, a, /)\n"
5596 "--\n"
5597 "\n");
5598
5599 #define TEST_CRITICAL_SECTION_METH_O_METHODDEF \
5600 {"test_critical_section_meth_o", (PyCFunction)test_critical_section_meth_o, METH_O, test_critical_section_meth_o__doc__},
5601
5602 static PyObject *
5603 test_critical_section_meth_o_impl(PyObject *module, PyObject *a);
5604
5605 static PyObject *
5606 test_critical_section_meth_o(PyObject *module, PyObject *arg)
5607 {
5608 PyObject *return_value = NULL;
5609 PyObject *a;
5610
5611 if (!PyUnicode_Check(arg)) {
5612 _PyArg_BadArgument("test_critical_section_meth_o", "argument", "str", arg);
5613 goto exit;
5614 }
5615 a = arg;
5616 Py_BEGIN_CRITICAL_SECTION(module);
5617 return_value = test_critical_section_meth_o_impl(module, a);
5618 Py_END_CRITICAL_SECTION();
5619
5620 exit:
5621 return return_value;
5622 }
5623
5624 static PyObject *
5625 test_critical_section_meth_o_impl(PyObject *module, PyObject *a)
5626 /*[clinic end generated code: output=7a9d7420802d1202 input=376533f51eceb6c3]*/
5627
5628 /*[clinic input]
5629 @critical_section a
5630 test_critical_section_object
5631 a: object(subclass_of="&PyUnicode_Type")
5632 /
5633 test_critical_section_object
5634 [clinic start generated code]*/
5635
5636 PyDoc_STRVAR(test_critical_section_object__doc__,
5637 "test_critical_section_object($module, a, /)\n"
5638 "--\n"
5639 "\n"
5640 "test_critical_section_object");
5641
5642 #define TEST_CRITICAL_SECTION_OBJECT_METHODDEF \
5643 {"test_critical_section_object", (PyCFunction)test_critical_section_object, METH_O, test_critical_section_object__doc__},
5644
5645 static PyObject *
5646 test_critical_section_object_impl(PyObject *module, PyObject *a);
5647
5648 static PyObject *
5649 test_critical_section_object(PyObject *module, PyObject *arg)
5650 {
5651 PyObject *return_value = NULL;
5652 PyObject *a;
5653
5654 if (!PyUnicode_Check(arg)) {
5655 _PyArg_BadArgument("test_critical_section_object", "argument", "str", arg);
5656 goto exit;
5657 }
5658 a = arg;
5659 Py_BEGIN_CRITICAL_SECTION(a);
5660 return_value = test_critical_section_object_impl(module, a);
5661 Py_END_CRITICAL_SECTION();
5662
5663 exit:
5664 return return_value;
5665 }
5666
5667 static PyObject *
5668 test_critical_section_object_impl(PyObject *module, PyObject *a)
5669 /*[clinic end generated code: output=ec06df92232b0fb5 input=6f67f91b523c875f]*/
5670
5671 PyDoc_STRVAR(test_critical_section_object__doc__,
5672 "test_critical_section_object($module, a, /)\n"
5673 "--\n"
5674 "\n"
5675 "test_critical_section_object");
5676
5677 #define TEST_CRITICAL_SECTION_OBJECT_METHODDEF \
5678 {"test_critical_section_object", (PyCFunction)test_critical_section_object, METH_O, test_critical_section_object__doc__},
5679
5680 static PyObject *
5681 test_critical_section_object_impl(PyObject *module, PyObject *a);
5682
5683 static PyObject *
5684 test_critical_section_object(PyObject *module, PyObject *arg)
5685 {
5686 PyObject *return_value = NULL;
5687 PyObject *a;
5688
5689 if (!PyUnicode_Check(arg)) {
5690 _PyArg_BadArgument("test_critical_section_object", "argument", "str", arg);
5691 goto exit;
5692 }
5693 a = arg;
5694 Py_BEGIN_CRITICAL_SECTION(a);
5695 return_value = test_critical_section_object_impl(module, a);
5696 Py_END_CRITICAL_SECTION();
5697
5698 exit:
5699 return return_value;
5700 }
5701
5702 /*[clinic input]
5703 @critical_section a b
5704 test_critical_section_object2
5705 a: object(subclass_of="&PyUnicode_Type")
5706 b: object(subclass_of="&PyUnicode_Type")
5707 /
5708 test_critical_section_object2
5709 [clinic start generated code]*/
5710
5711 PyDoc_STRVAR(test_critical_section_object2__doc__,
5712 "test_critical_section_object2($module, a, b, /)\n"
5713 "--\n"
5714 "\n"
5715 "test_critical_section_object2");
5716
5717 #define TEST_CRITICAL_SECTION_OBJECT2_METHODDEF \
5718 {"test_critical_section_object2", _PyCFunction_CAST(test_critical_section_object2), METH_FASTCALL, test_critical_section_object2__doc__},
5719
5720 static PyObject *
5721 test_critical_section_object2_impl(PyObject *module, PyObject *a,
5722 PyObject *b);
5723
5724 static PyObject *
5725 test_critical_section_object2(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
5726 {
5727 PyObject *return_value = NULL;
5728 PyObject *a;
5729 PyObject *b;
5730
5731 if (!_PyArg_CheckPositional("test_critical_section_object2", nargs, 2, 2)) {
5732 goto exit;
5733 }
5734 if (!PyUnicode_Check(args[0])) {
5735 _PyArg_BadArgument("test_critical_section_object2", "argument 1", "str", args[0]);
5736 goto exit;
5737 }
5738 a = args[0];
5739 if (!PyUnicode_Check(args[1])) {
5740 _PyArg_BadArgument("test_critical_section_object2", "argument 2", "str", args[1]);
5741 goto exit;
5742 }
5743 b = args[1];
5744 Py_BEGIN_CRITICAL_SECTION2(a, b);
5745 return_value = test_critical_section_object2_impl(module, a, b);
5746 Py_END_CRITICAL_SECTION2();
5747
5748 exit:
5749 return return_value;
5750 }
5751
5752 static PyObject *
5753 test_critical_section_object2_impl(PyObject *module, PyObject *a,
5754 PyObject *b)
5755 /*[clinic end generated code: output=d73a1657c18df17a input=638824e41419a466]*/
5756
5757 PyDoc_STRVAR(test_critical_section_object2__doc__,
5758 "test_critical_section_object2($module, a, b, /)\n"
5759 "--\n"
5760 "\n"
5761 "test_critical_section_object2");
5762
5763 #define TEST_CRITICAL_SECTION_OBJECT2_METHODDEF \
5764 {"test_critical_section_object2", _PyCFunction_CAST(test_critical_section_object2), METH_FASTCALL, test_critical_section_object2__doc__},
5765
5766 static PyObject *
5767 test_critical_section_object2_impl(PyObject *module, PyObject *a,
5768 PyObject *b);
5769
5770 static PyObject *
5771 test_critical_section_object2(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
5772 {
5773 PyObject *return_value = NULL;
5774 PyObject *a;
5775 PyObject *b;
5776
5777 if (!_PyArg_CheckPositional("test_critical_section_object2", nargs, 2, 2)) {
5778 goto exit;
5779 }
5780 if (!PyUnicode_Check(args[0])) {
5781 _PyArg_BadArgument("test_critical_section_object2", "argument 1", "str", args[0]);
5782 goto exit;
5783 }
5784 a = args[0];
5785 if (!PyUnicode_Check(args[1])) {
5786 _PyArg_BadArgument("test_critical_section_object2", "argument 2", "str", args[1]);
5787 goto exit;
5788 }
5789 b = args[1];
5790 Py_BEGIN_CRITICAL_SECTION2(a, b);
5791 return_value = test_critical_section_object2_impl(module, a, b);
5792 Py_END_CRITICAL_SECTION2();
5793
5794 exit:
5795 return return_value;
5796 }