blob: 0d84d5ef5359ad4fab7ed96f9b22fbbf3f60b3af [file] [log] [blame]
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001/*[clinic input]
2output preset block
3[clinic start generated code]*/
4/*[clinic end generated code: output=da39a3ee5e6b4b0d input=3c81ac2402d06a8b]*/
5
Serhiy Storchaka31913912019-03-14 10:32:22 +02006
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02007/*[clinic input]
8test_object_converter
9
10 a: object
11 b: object(converter="PyUnicode_FSConverter")
12 c: object(subclass_of="&PyUnicode_Type")
13 d: object(type="PyUnicode_Object *")
14 /
15
16[clinic start generated code]*/
17
18PyDoc_STRVAR(test_object_converter__doc__,
19"test_object_converter($module, a, b, c, d, /)\n"
20"--\n"
21"\n");
22
23#define TEST_OBJECT_CONVERTER_METHODDEF \
24 {"test_object_converter", (PyCFunction)(void(*)(void))test_object_converter, METH_FASTCALL, test_object_converter__doc__},
25
26static PyObject *
27test_object_converter_impl(PyObject *module, PyObject *a, PyObject *b,
28 PyObject *c, PyUnicode_Object *d);
29
30static PyObject *
31test_object_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
32{
33 PyObject *return_value = NULL;
34 PyObject *a;
35 PyObject *b;
36 PyObject *c;
37 PyUnicode_Object *d;
38
Serhiy Storchaka4fa95912019-01-11 16:01:14 +020039 if (!_PyArg_CheckPositional("test_object_converter", nargs, 4, 4)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020040 goto exit;
41 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +020042 a = args[0];
43 if (!PyUnicode_FSConverter(args[1], &b)) {
44 goto exit;
45 }
46 if (!PyUnicode_Check(args[2])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +030047 _PyArg_BadArgument("test_object_converter", "argument 3", "str", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +020048 goto exit;
49 }
50 c = args[2];
51 d = (PyUnicode_Object *)args[3];
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020052 return_value = test_object_converter_impl(module, a, b, c, d);
53
54exit:
55 return return_value;
56}
57
58static PyObject *
59test_object_converter_impl(PyObject *module, PyObject *a, PyObject *b,
60 PyObject *c, PyUnicode_Object *d)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +030061/*[clinic end generated code: output=a78312d933df9ea1 input=005e6a8a711a869b]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020062
Serhiy Storchaka31913912019-03-14 10:32:22 +020063
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020064/*[clinic input]
65test_object_converter_one_arg
66
67 a: object
68 /
69
70[clinic start generated code]*/
71
72PyDoc_STRVAR(test_object_converter_one_arg__doc__,
73"test_object_converter_one_arg($module, a, /)\n"
74"--\n"
75"\n");
76
77#define TEST_OBJECT_CONVERTER_ONE_ARG_METHODDEF \
78 {"test_object_converter_one_arg", (PyCFunction)test_object_converter_one_arg, METH_O, test_object_converter_one_arg__doc__},
79
80static PyObject *
81test_object_converter_one_arg(PyObject *module, PyObject *a)
82/*[clinic end generated code: output=6da755f8502139df input=d635d92a421f1ca3]*/
83
Serhiy Storchaka31913912019-03-14 10:32:22 +020084
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020085/*[clinic input]
86test_objects_converter
87
88 a: object
89 b: object = NULL
90 /
91
92[clinic start generated code]*/
93
94PyDoc_STRVAR(test_objects_converter__doc__,
Serhiy Storchakad322abb2019-09-14 13:31:50 +030095"test_objects_converter($module, a, b=<unrepresentable>, /)\n"
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +020096"--\n"
97"\n");
98
99#define TEST_OBJECTS_CONVERTER_METHODDEF \
100 {"test_objects_converter", (PyCFunction)(void(*)(void))test_objects_converter, METH_FASTCALL, test_objects_converter__doc__},
101
102static PyObject *
103test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b);
104
105static PyObject *
106test_objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
107{
108 PyObject *return_value = NULL;
109 PyObject *a;
110 PyObject *b = NULL;
111
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200112 if (!_PyArg_CheckPositional("test_objects_converter", nargs, 1, 2)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200113 goto exit;
114 }
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200115 a = args[0];
116 if (nargs < 2) {
117 goto skip_optional;
118 }
119 b = args[1];
120skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200121 return_value = test_objects_converter_impl(module, a, b);
122
123exit:
124 return return_value;
125}
126
127static PyObject *
128test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
Serhiy Storchakad322abb2019-09-14 13:31:50 +0300129/*[clinic end generated code: output=0e461f38d3b2bd08 input=4cbb3d9edd2a36f3]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200130
Serhiy Storchaka31913912019-03-14 10:32:22 +0200131
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200132/*[clinic input]
133test_object_converter_subclass_of
134
135 a: object(subclass_of="&PyLong_Type")
136 b: object(subclass_of="&PyTuple_Type")
137 c: object(subclass_of="&PyList_Type")
138 d: object(subclass_of="&PySet_Type")
139 e: object(subclass_of="&PyFrozenSet_Type")
140 f: object(subclass_of="&PyDict_Type")
141 g: object(subclass_of="&PyUnicode_Type")
142 h: object(subclass_of="&PyBytes_Type")
143 i: object(subclass_of="&PyByteArray_Type")
144 j: object(subclass_of="&MyType")
145 /
146
147[clinic start generated code]*/
148
149PyDoc_STRVAR(test_object_converter_subclass_of__doc__,
150"test_object_converter_subclass_of($module, a, b, c, d, e, f, g, h, i,\n"
151" j, /)\n"
152"--\n"
153"\n");
154
155#define TEST_OBJECT_CONVERTER_SUBCLASS_OF_METHODDEF \
156 {"test_object_converter_subclass_of", (PyCFunction)(void(*)(void))test_object_converter_subclass_of, METH_FASTCALL, test_object_converter_subclass_of__doc__},
157
158static PyObject *
159test_object_converter_subclass_of_impl(PyObject *module, PyObject *a,
160 PyObject *b, PyObject *c, PyObject *d,
161 PyObject *e, PyObject *f, PyObject *g,
162 PyObject *h, PyObject *i, PyObject *j);
163
164static PyObject *
165test_object_converter_subclass_of(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
166{
167 PyObject *return_value = NULL;
168 PyObject *a;
169 PyObject *b;
170 PyObject *c;
171 PyObject *d;
172 PyObject *e;
173 PyObject *f;
174 PyObject *g;
175 PyObject *h;
176 PyObject *i;
177 PyObject *j;
178
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200179 if (!_PyArg_CheckPositional("test_object_converter_subclass_of", nargs, 10, 10)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200180 goto exit;
181 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200182 if (!PyLong_Check(args[0])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300183 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 1", "int", args[0]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200184 goto exit;
185 }
186 a = args[0];
187 if (!PyTuple_Check(args[1])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300188 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 2", "tuple", args[1]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200189 goto exit;
190 }
191 b = args[1];
192 if (!PyList_Check(args[2])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300193 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 3", "list", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200194 goto exit;
195 }
196 c = args[2];
197 if (!PySet_Check(args[3])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300198 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 4", "set", args[3]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200199 goto exit;
200 }
201 d = args[3];
202 if (!PyFrozenSet_Check(args[4])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300203 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 5", "frozenset", args[4]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200204 goto exit;
205 }
206 e = args[4];
207 if (!PyDict_Check(args[5])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300208 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 6", "dict", args[5]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200209 goto exit;
210 }
211 f = args[5];
212 if (!PyUnicode_Check(args[6])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300213 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 7", "str", args[6]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200214 goto exit;
215 }
216 g = args[6];
217 if (!PyBytes_Check(args[7])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300218 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 8", "bytes", args[7]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200219 goto exit;
220 }
221 h = args[7];
222 if (!PyByteArray_Check(args[8])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300223 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 9", "bytearray", args[8]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200224 goto exit;
225 }
226 i = args[8];
227 if (!PyObject_TypeCheck(args[9], &MyType)) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300228 _PyArg_BadArgument("test_object_converter_subclass_of", "argument 10", (&MyType)->tp_name, args[9]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200229 goto exit;
230 }
231 j = args[9];
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200232 return_value = test_object_converter_subclass_of_impl(module, a, b, c, d, e, f, g, h, i, j);
233
234exit:
235 return return_value;
236}
237
238static PyObject *
239test_object_converter_subclass_of_impl(PyObject *module, PyObject *a,
240 PyObject *b, PyObject *c, PyObject *d,
241 PyObject *e, PyObject *f, PyObject *g,
242 PyObject *h, PyObject *i, PyObject *j)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300243/*[clinic end generated code: output=dcf7772bf0c876dd input=31b06b772d5f983e]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200244
Serhiy Storchaka31913912019-03-14 10:32:22 +0200245
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200246/*[clinic input]
247test_PyBytesObject_converter
248
249 a: PyBytesObject
250 /
251
252[clinic start generated code]*/
253
254PyDoc_STRVAR(test_PyBytesObject_converter__doc__,
255"test_PyBytesObject_converter($module, a, /)\n"
256"--\n"
257"\n");
258
259#define TEST_PYBYTESOBJECT_CONVERTER_METHODDEF \
260 {"test_PyBytesObject_converter", (PyCFunction)test_PyBytesObject_converter, METH_O, test_PyBytesObject_converter__doc__},
261
262static PyObject *
263test_PyBytesObject_converter_impl(PyObject *module, PyBytesObject *a);
264
265static PyObject *
266test_PyBytesObject_converter(PyObject *module, PyObject *arg)
267{
268 PyObject *return_value = NULL;
269 PyBytesObject *a;
270
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200271 if (!PyBytes_Check(arg)) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300272 _PyArg_BadArgument("test_PyBytesObject_converter", "argument", "bytes", arg);
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200273 goto exit;
274 }
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200275 a = (PyBytesObject *)arg;
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200276 return_value = test_PyBytesObject_converter_impl(module, a);
277
278exit:
279 return return_value;
280}
281
282static PyObject *
283test_PyBytesObject_converter_impl(PyObject *module, PyBytesObject *a)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300284/*[clinic end generated code: output=7539d628e6fceace input=12b10c7cb5750400]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200285
Serhiy Storchaka31913912019-03-14 10:32:22 +0200286
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200287/*[clinic input]
288test_PyByteArrayObject_converter
289
290 a: PyByteArrayObject
291 /
292
293[clinic start generated code]*/
294
295PyDoc_STRVAR(test_PyByteArrayObject_converter__doc__,
296"test_PyByteArrayObject_converter($module, a, /)\n"
297"--\n"
298"\n");
299
300#define TEST_PYBYTEARRAYOBJECT_CONVERTER_METHODDEF \
301 {"test_PyByteArrayObject_converter", (PyCFunction)test_PyByteArrayObject_converter, METH_O, test_PyByteArrayObject_converter__doc__},
302
303static PyObject *
304test_PyByteArrayObject_converter_impl(PyObject *module, PyByteArrayObject *a);
305
306static PyObject *
307test_PyByteArrayObject_converter(PyObject *module, PyObject *arg)
308{
309 PyObject *return_value = NULL;
310 PyByteArrayObject *a;
311
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200312 if (!PyByteArray_Check(arg)) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300313 _PyArg_BadArgument("test_PyByteArrayObject_converter", "argument", "bytearray", arg);
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200314 goto exit;
315 }
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200316 a = (PyByteArrayObject *)arg;
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200317 return_value = test_PyByteArrayObject_converter_impl(module, a);
318
319exit:
320 return return_value;
321}
322
323static PyObject *
324test_PyByteArrayObject_converter_impl(PyObject *module, PyByteArrayObject *a)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300325/*[clinic end generated code: output=1245af9f5b3e355e input=5a657da535d194ae]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200326
Serhiy Storchaka31913912019-03-14 10:32:22 +0200327
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200328/*[clinic input]
329test_unicode_converter
330
331 a: unicode
332 /
333
334[clinic start generated code]*/
335
336PyDoc_STRVAR(test_unicode_converter__doc__,
337"test_unicode_converter($module, a, /)\n"
338"--\n"
339"\n");
340
341#define TEST_UNICODE_CONVERTER_METHODDEF \
342 {"test_unicode_converter", (PyCFunction)test_unicode_converter, METH_O, test_unicode_converter__doc__},
343
344static PyObject *
345test_unicode_converter_impl(PyObject *module, PyObject *a);
346
347static PyObject *
348test_unicode_converter(PyObject *module, PyObject *arg)
349{
350 PyObject *return_value = NULL;
351 PyObject *a;
352
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200353 if (!PyUnicode_Check(arg)) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300354 _PyArg_BadArgument("test_unicode_converter", "argument", "str", arg);
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200355 goto exit;
356 }
Serhiy Storchaka32d96a22018-12-25 13:23:47 +0200357 if (PyUnicode_READY(arg) == -1) {
358 goto exit;
359 }
360 a = arg;
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200361 return_value = test_unicode_converter_impl(module, a);
362
363exit:
364 return return_value;
365}
366
367static PyObject *
368test_unicode_converter_impl(PyObject *module, PyObject *a)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300369/*[clinic end generated code: output=18f1e3880c862611 input=aa33612df92aa9c5]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200370
Serhiy Storchaka31913912019-03-14 10:32:22 +0200371
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200372/*[clinic input]
373test_bool_converter
374
375 a: bool = True
376 b: bool(accept={object}) = True
377 c: bool(accept={int}) = True
378 /
379
380[clinic start generated code]*/
381
382PyDoc_STRVAR(test_bool_converter__doc__,
383"test_bool_converter($module, a=True, b=True, c=True, /)\n"
384"--\n"
385"\n");
386
387#define TEST_BOOL_CONVERTER_METHODDEF \
388 {"test_bool_converter", (PyCFunction)(void(*)(void))test_bool_converter, METH_FASTCALL, test_bool_converter__doc__},
389
390static PyObject *
391test_bool_converter_impl(PyObject *module, int a, int b, int c);
392
393static PyObject *
394test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
395{
396 PyObject *return_value = NULL;
397 int a = 1;
398 int b = 1;
399 int c = 1;
400
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200401 if (!_PyArg_CheckPositional("test_bool_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200402 goto exit;
403 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200404 if (nargs < 1) {
405 goto skip_optional;
406 }
407 a = PyObject_IsTrue(args[0]);
408 if (a < 0) {
409 goto exit;
410 }
411 if (nargs < 2) {
412 goto skip_optional;
413 }
414 b = PyObject_IsTrue(args[1]);
415 if (b < 0) {
416 goto exit;
417 }
418 if (nargs < 3) {
419 goto skip_optional;
420 }
421 if (PyFloat_Check(args[2])) {
422 PyErr_SetString(PyExc_TypeError,
423 "integer argument expected, got float" );
424 goto exit;
425 }
426 c = _PyLong_AsInt(args[2]);
427 if (c == -1 && PyErr_Occurred()) {
428 goto exit;
429 }
430skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200431 return_value = test_bool_converter_impl(module, a, b, c);
432
433exit:
434 return return_value;
435}
436
437static PyObject *
438test_bool_converter_impl(PyObject *module, int a, int b, int c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200439/*[clinic end generated code: output=25f20963894256a1 input=939854fa9f248c60]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200440
Serhiy Storchaka31913912019-03-14 10:32:22 +0200441
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200442/*[clinic input]
443test_char_converter
444
445 a: char = b'A'
446 b: char = b'\a'
447 c: char = b'\b'
448 d: char = b'\t'
449 e: char = b'\n'
450 f: char = b'\v'
451 g: char = b'\f'
452 h: char = b'\r'
453 i: char = b'"'
454 j: char = b"'"
455 k: char = b'?'
456 l: char = b'\\'
457 m: char = b'\000'
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200458 n: char = b'\377'
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200459 /
460
461[clinic start generated code]*/
462
463PyDoc_STRVAR(test_char_converter__doc__,
464"test_char_converter($module, a=b\'A\', b=b\'\\x07\', c=b\'\\x08\', d=b\'\\t\',\n"
465" e=b\'\\n\', f=b\'\\x0b\', g=b\'\\x0c\', h=b\'\\r\', i=b\'\"\',\n"
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200466" j=b\"\'\", k=b\'?\', l=b\'\\\\\', m=b\'\\x00\', n=b\'\\xff\', /)\n"
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200467"--\n"
468"\n");
469
470#define TEST_CHAR_CONVERTER_METHODDEF \
471 {"test_char_converter", (PyCFunction)(void(*)(void))test_char_converter, METH_FASTCALL, test_char_converter__doc__},
472
473static PyObject *
474test_char_converter_impl(PyObject *module, char a, char b, char c, char d,
475 char e, char f, char g, char h, char i, char j,
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200476 char k, char l, char m, char n);
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200477
478static PyObject *
479test_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
480{
481 PyObject *return_value = NULL;
482 char a = 'A';
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200483 char b = '\x07';
484 char c = '\x08';
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200485 char d = '\t';
486 char e = '\n';
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200487 char f = '\x0b';
488 char g = '\x0c';
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200489 char h = '\r';
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200490 char i = '"';
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200491 char j = '\'';
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200492 char k = '?';
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200493 char l = '\\';
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200494 char m = '\x00';
495 char n = '\xff';
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200496
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200497 if (!_PyArg_CheckPositional("test_char_converter", nargs, 0, 14)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200498 goto exit;
499 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200500 if (nargs < 1) {
501 goto skip_optional;
502 }
503 if (PyBytes_Check(args[0]) && PyBytes_GET_SIZE(args[0]) == 1) {
504 a = PyBytes_AS_STRING(args[0])[0];
505 }
506 else if (PyByteArray_Check(args[0]) && PyByteArray_GET_SIZE(args[0]) == 1) {
507 a = PyByteArray_AS_STRING(args[0])[0];
508 }
509 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300510 _PyArg_BadArgument("test_char_converter", "argument 1", "a byte string of length 1", args[0]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200511 goto exit;
512 }
513 if (nargs < 2) {
514 goto skip_optional;
515 }
516 if (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) {
517 b = PyBytes_AS_STRING(args[1])[0];
518 }
519 else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) {
520 b = PyByteArray_AS_STRING(args[1])[0];
521 }
522 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300523 _PyArg_BadArgument("test_char_converter", "argument 2", "a byte string of length 1", args[1]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200524 goto exit;
525 }
526 if (nargs < 3) {
527 goto skip_optional;
528 }
529 if (PyBytes_Check(args[2]) && PyBytes_GET_SIZE(args[2]) == 1) {
530 c = PyBytes_AS_STRING(args[2])[0];
531 }
532 else if (PyByteArray_Check(args[2]) && PyByteArray_GET_SIZE(args[2]) == 1) {
533 c = PyByteArray_AS_STRING(args[2])[0];
534 }
535 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300536 _PyArg_BadArgument("test_char_converter", "argument 3", "a byte string of length 1", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200537 goto exit;
538 }
539 if (nargs < 4) {
540 goto skip_optional;
541 }
542 if (PyBytes_Check(args[3]) && PyBytes_GET_SIZE(args[3]) == 1) {
543 d = PyBytes_AS_STRING(args[3])[0];
544 }
545 else if (PyByteArray_Check(args[3]) && PyByteArray_GET_SIZE(args[3]) == 1) {
546 d = PyByteArray_AS_STRING(args[3])[0];
547 }
548 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300549 _PyArg_BadArgument("test_char_converter", "argument 4", "a byte string of length 1", args[3]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200550 goto exit;
551 }
552 if (nargs < 5) {
553 goto skip_optional;
554 }
555 if (PyBytes_Check(args[4]) && PyBytes_GET_SIZE(args[4]) == 1) {
556 e = PyBytes_AS_STRING(args[4])[0];
557 }
558 else if (PyByteArray_Check(args[4]) && PyByteArray_GET_SIZE(args[4]) == 1) {
559 e = PyByteArray_AS_STRING(args[4])[0];
560 }
561 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300562 _PyArg_BadArgument("test_char_converter", "argument 5", "a byte string of length 1", args[4]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200563 goto exit;
564 }
565 if (nargs < 6) {
566 goto skip_optional;
567 }
568 if (PyBytes_Check(args[5]) && PyBytes_GET_SIZE(args[5]) == 1) {
569 f = PyBytes_AS_STRING(args[5])[0];
570 }
571 else if (PyByteArray_Check(args[5]) && PyByteArray_GET_SIZE(args[5]) == 1) {
572 f = PyByteArray_AS_STRING(args[5])[0];
573 }
574 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300575 _PyArg_BadArgument("test_char_converter", "argument 6", "a byte string of length 1", args[5]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200576 goto exit;
577 }
578 if (nargs < 7) {
579 goto skip_optional;
580 }
581 if (PyBytes_Check(args[6]) && PyBytes_GET_SIZE(args[6]) == 1) {
582 g = PyBytes_AS_STRING(args[6])[0];
583 }
584 else if (PyByteArray_Check(args[6]) && PyByteArray_GET_SIZE(args[6]) == 1) {
585 g = PyByteArray_AS_STRING(args[6])[0];
586 }
587 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300588 _PyArg_BadArgument("test_char_converter", "argument 7", "a byte string of length 1", args[6]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200589 goto exit;
590 }
591 if (nargs < 8) {
592 goto skip_optional;
593 }
594 if (PyBytes_Check(args[7]) && PyBytes_GET_SIZE(args[7]) == 1) {
595 h = PyBytes_AS_STRING(args[7])[0];
596 }
597 else if (PyByteArray_Check(args[7]) && PyByteArray_GET_SIZE(args[7]) == 1) {
598 h = PyByteArray_AS_STRING(args[7])[0];
599 }
600 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300601 _PyArg_BadArgument("test_char_converter", "argument 8", "a byte string of length 1", args[7]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200602 goto exit;
603 }
604 if (nargs < 9) {
605 goto skip_optional;
606 }
607 if (PyBytes_Check(args[8]) && PyBytes_GET_SIZE(args[8]) == 1) {
608 i = PyBytes_AS_STRING(args[8])[0];
609 }
610 else if (PyByteArray_Check(args[8]) && PyByteArray_GET_SIZE(args[8]) == 1) {
611 i = PyByteArray_AS_STRING(args[8])[0];
612 }
613 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300614 _PyArg_BadArgument("test_char_converter", "argument 9", "a byte string of length 1", args[8]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200615 goto exit;
616 }
617 if (nargs < 10) {
618 goto skip_optional;
619 }
620 if (PyBytes_Check(args[9]) && PyBytes_GET_SIZE(args[9]) == 1) {
621 j = PyBytes_AS_STRING(args[9])[0];
622 }
623 else if (PyByteArray_Check(args[9]) && PyByteArray_GET_SIZE(args[9]) == 1) {
624 j = PyByteArray_AS_STRING(args[9])[0];
625 }
626 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300627 _PyArg_BadArgument("test_char_converter", "argument 10", "a byte string of length 1", args[9]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200628 goto exit;
629 }
630 if (nargs < 11) {
631 goto skip_optional;
632 }
633 if (PyBytes_Check(args[10]) && PyBytes_GET_SIZE(args[10]) == 1) {
634 k = PyBytes_AS_STRING(args[10])[0];
635 }
636 else if (PyByteArray_Check(args[10]) && PyByteArray_GET_SIZE(args[10]) == 1) {
637 k = PyByteArray_AS_STRING(args[10])[0];
638 }
639 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300640 _PyArg_BadArgument("test_char_converter", "argument 11", "a byte string of length 1", args[10]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200641 goto exit;
642 }
643 if (nargs < 12) {
644 goto skip_optional;
645 }
646 if (PyBytes_Check(args[11]) && PyBytes_GET_SIZE(args[11]) == 1) {
647 l = PyBytes_AS_STRING(args[11])[0];
648 }
649 else if (PyByteArray_Check(args[11]) && PyByteArray_GET_SIZE(args[11]) == 1) {
650 l = PyByteArray_AS_STRING(args[11])[0];
651 }
652 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300653 _PyArg_BadArgument("test_char_converter", "argument 12", "a byte string of length 1", args[11]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200654 goto exit;
655 }
656 if (nargs < 13) {
657 goto skip_optional;
658 }
659 if (PyBytes_Check(args[12]) && PyBytes_GET_SIZE(args[12]) == 1) {
660 m = PyBytes_AS_STRING(args[12])[0];
661 }
662 else if (PyByteArray_Check(args[12]) && PyByteArray_GET_SIZE(args[12]) == 1) {
663 m = PyByteArray_AS_STRING(args[12])[0];
664 }
665 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300666 _PyArg_BadArgument("test_char_converter", "argument 13", "a byte string of length 1", args[12]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200667 goto exit;
668 }
669 if (nargs < 14) {
670 goto skip_optional;
671 }
672 if (PyBytes_Check(args[13]) && PyBytes_GET_SIZE(args[13]) == 1) {
673 n = PyBytes_AS_STRING(args[13])[0];
674 }
675 else if (PyByteArray_Check(args[13]) && PyByteArray_GET_SIZE(args[13]) == 1) {
676 n = PyByteArray_AS_STRING(args[13])[0];
677 }
678 else {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300679 _PyArg_BadArgument("test_char_converter", "argument 14", "a byte string of length 1", args[13]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200680 goto exit;
681 }
682skip_optional:
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200683 return_value = test_char_converter_impl(module, a, b, c, d, e, f, g, h, i, j, k, l, m, n);
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200684
685exit:
686 return return_value;
687}
688
689static PyObject *
690test_char_converter_impl(PyObject *module, char a, char b, char c, char d,
691 char e, char f, char g, char h, char i, char j,
Serhiy Storchaka65ce60a2018-12-25 11:10:05 +0200692 char k, char l, char m, char n)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +0300693/*[clinic end generated code: output=9d3aaf5d6857ec9e input=e42330417a44feac]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200694
Serhiy Storchaka31913912019-03-14 10:32:22 +0200695
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200696/*[clinic input]
697test_unsigned_char_converter
698
699 a: unsigned_char = 12
700 b: unsigned_char(bitwise=False) = 34
701 c: unsigned_char(bitwise=True) = 56
702 /
703
704[clinic start generated code]*/
705
706PyDoc_STRVAR(test_unsigned_char_converter__doc__,
707"test_unsigned_char_converter($module, a=12, b=34, c=56, /)\n"
708"--\n"
709"\n");
710
711#define TEST_UNSIGNED_CHAR_CONVERTER_METHODDEF \
712 {"test_unsigned_char_converter", (PyCFunction)(void(*)(void))test_unsigned_char_converter, METH_FASTCALL, test_unsigned_char_converter__doc__},
713
714static PyObject *
715test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
716 unsigned char b, unsigned char c);
717
718static PyObject *
719test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
720{
721 PyObject *return_value = NULL;
722 unsigned char a = 12;
723 unsigned char b = 34;
724 unsigned char c = 56;
725
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200726 if (!_PyArg_CheckPositional("test_unsigned_char_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200727 goto exit;
728 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200729 if (nargs < 1) {
730 goto skip_optional;
731 }
732 if (PyFloat_Check(args[0])) {
733 PyErr_SetString(PyExc_TypeError,
734 "integer argument expected, got float" );
735 goto exit;
736 }
737 {
738 long ival = PyLong_AsLong(args[0]);
739 if (ival == -1 && PyErr_Occurred()) {
740 goto exit;
741 }
742 else if (ival < 0) {
743 PyErr_SetString(PyExc_OverflowError,
744 "unsigned byte integer is less than minimum");
745 goto exit;
746 }
747 else if (ival > UCHAR_MAX) {
748 PyErr_SetString(PyExc_OverflowError,
749 "unsigned byte integer is greater than maximum");
750 goto exit;
751 }
752 else {
753 a = (unsigned char) ival;
754 }
755 }
756 if (nargs < 2) {
757 goto skip_optional;
758 }
759 if (PyFloat_Check(args[1])) {
760 PyErr_SetString(PyExc_TypeError,
761 "integer argument expected, got float" );
762 goto exit;
763 }
764 {
765 long ival = PyLong_AsLong(args[1]);
766 if (ival == -1 && PyErr_Occurred()) {
767 goto exit;
768 }
769 else if (ival < 0) {
770 PyErr_SetString(PyExc_OverflowError,
771 "unsigned byte integer is less than minimum");
772 goto exit;
773 }
774 else if (ival > UCHAR_MAX) {
775 PyErr_SetString(PyExc_OverflowError,
776 "unsigned byte integer is greater than maximum");
777 goto exit;
778 }
779 else {
780 b = (unsigned char) ival;
781 }
782 }
783 if (nargs < 3) {
784 goto skip_optional;
785 }
786 if (PyFloat_Check(args[2])) {
787 PyErr_SetString(PyExc_TypeError,
788 "integer argument expected, got float" );
789 goto exit;
790 }
791 {
792 long ival = PyLong_AsUnsignedLongMask(args[2]);
793 if (ival == -1 && PyErr_Occurred()) {
794 goto exit;
795 }
796 else {
797 c = (unsigned char) ival;
798 }
799 }
800skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200801 return_value = test_unsigned_char_converter_impl(module, a, b, c);
802
803exit:
804 return return_value;
805}
806
807static PyObject *
808test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
809 unsigned char b, unsigned char c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200810/*[clinic end generated code: output=ebf905c5c9414762 input=021414060993e289]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200811
Serhiy Storchaka31913912019-03-14 10:32:22 +0200812
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200813/*[clinic input]
814test_short_converter
815
816 a: short = 12
817 /
818
819[clinic start generated code]*/
820
821PyDoc_STRVAR(test_short_converter__doc__,
822"test_short_converter($module, a=12, /)\n"
823"--\n"
824"\n");
825
826#define TEST_SHORT_CONVERTER_METHODDEF \
827 {"test_short_converter", (PyCFunction)(void(*)(void))test_short_converter, METH_FASTCALL, test_short_converter__doc__},
828
829static PyObject *
830test_short_converter_impl(PyObject *module, short a);
831
832static PyObject *
833test_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
834{
835 PyObject *return_value = NULL;
836 short a = 12;
837
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200838 if (!_PyArg_CheckPositional("test_short_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200839 goto exit;
840 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200841 if (nargs < 1) {
842 goto skip_optional;
843 }
844 if (PyFloat_Check(args[0])) {
845 PyErr_SetString(PyExc_TypeError,
846 "integer argument expected, got float" );
847 goto exit;
848 }
849 {
850 long ival = PyLong_AsLong(args[0]);
851 if (ival == -1 && PyErr_Occurred()) {
852 goto exit;
853 }
854 else if (ival < SHRT_MIN) {
855 PyErr_SetString(PyExc_OverflowError,
856 "signed short integer is less than minimum");
857 goto exit;
858 }
859 else if (ival > SHRT_MAX) {
860 PyErr_SetString(PyExc_OverflowError,
861 "signed short integer is greater than maximum");
862 goto exit;
863 }
864 else {
865 a = (short) ival;
866 }
867 }
868skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200869 return_value = test_short_converter_impl(module, a);
870
871exit:
872 return return_value;
873}
874
875static PyObject *
876test_short_converter_impl(PyObject *module, short a)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200877/*[clinic end generated code: output=86fe1a1496a7ff20 input=6a8a7a509a498ff4]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200878
Serhiy Storchaka31913912019-03-14 10:32:22 +0200879
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200880/*[clinic input]
881test_unsigned_short_converter
882
883 a: unsigned_short = 12
884 b: unsigned_short(bitwise=False) = 34
885 c: unsigned_short(bitwise=True) = 56
886 /
887
888[clinic start generated code]*/
889
890PyDoc_STRVAR(test_unsigned_short_converter__doc__,
891"test_unsigned_short_converter($module, a=12, b=34, c=56, /)\n"
892"--\n"
893"\n");
894
895#define TEST_UNSIGNED_SHORT_CONVERTER_METHODDEF \
896 {"test_unsigned_short_converter", (PyCFunction)(void(*)(void))test_unsigned_short_converter, METH_FASTCALL, test_unsigned_short_converter__doc__},
897
898static PyObject *
899test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
900 unsigned short b, unsigned short c);
901
902static PyObject *
903test_unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
904{
905 PyObject *return_value = NULL;
906 unsigned short a = 12;
907 unsigned short b = 34;
908 unsigned short c = 56;
909
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200910 if (!_PyArg_CheckPositional("test_unsigned_short_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200911 goto exit;
912 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200913 if (nargs < 1) {
914 goto skip_optional;
915 }
916 if (!_PyLong_UnsignedShort_Converter(args[0], &a)) {
917 goto exit;
918 }
919 if (nargs < 2) {
920 goto skip_optional;
921 }
922 if (!_PyLong_UnsignedShort_Converter(args[1], &b)) {
923 goto exit;
924 }
925 if (nargs < 3) {
926 goto skip_optional;
927 }
928 if (PyFloat_Check(args[2])) {
929 PyErr_SetString(PyExc_TypeError,
930 "integer argument expected, got float" );
931 goto exit;
932 }
933 c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]);
934 if (c == (unsigned short)-1 && PyErr_Occurred()) {
935 goto exit;
936 }
937skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200938 return_value = test_unsigned_short_converter_impl(module, a, b, c);
939
940exit:
941 return return_value;
942}
943
944static PyObject *
945test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
946 unsigned short b, unsigned short c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200947/*[clinic end generated code: output=3779fe104319e3ae input=cdfd8eff3d9176b4]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200948
Serhiy Storchaka31913912019-03-14 10:32:22 +0200949
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200950/*[clinic input]
951test_int_converter
952
953 a: int = 12
954 b: int(accept={int}) = 34
955 c: int(accept={str}) = 45
956 d: int(type='myenum') = 67
957 /
958
959[clinic start generated code]*/
960
961PyDoc_STRVAR(test_int_converter__doc__,
962"test_int_converter($module, a=12, b=34, c=45, d=67, /)\n"
963"--\n"
964"\n");
965
966#define TEST_INT_CONVERTER_METHODDEF \
967 {"test_int_converter", (PyCFunction)(void(*)(void))test_int_converter, METH_FASTCALL, test_int_converter__doc__},
968
969static PyObject *
970test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d);
971
972static PyObject *
973test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
974{
975 PyObject *return_value = NULL;
976 int a = 12;
977 int b = 34;
978 int c = 45;
979 myenum d = 67;
980
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200981 if (!_PyArg_CheckPositional("test_int_converter", nargs, 0, 4)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +0200982 goto exit;
983 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200984 if (nargs < 1) {
985 goto skip_optional;
986 }
987 if (PyFloat_Check(args[0])) {
988 PyErr_SetString(PyExc_TypeError,
989 "integer argument expected, got float" );
990 goto exit;
991 }
992 a = _PyLong_AsInt(args[0]);
993 if (a == -1 && PyErr_Occurred()) {
994 goto exit;
995 }
996 if (nargs < 2) {
997 goto skip_optional;
998 }
999 if (PyFloat_Check(args[1])) {
1000 PyErr_SetString(PyExc_TypeError,
1001 "integer argument expected, got float" );
1002 goto exit;
1003 }
1004 b = _PyLong_AsInt(args[1]);
1005 if (b == -1 && PyErr_Occurred()) {
1006 goto exit;
1007 }
1008 if (nargs < 3) {
1009 goto skip_optional;
1010 }
1011 if (!PyUnicode_Check(args[2])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001012 _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001013 goto exit;
1014 }
1015 if (PyUnicode_READY(args[2])) {
1016 goto exit;
1017 }
1018 if (PyUnicode_GET_LENGTH(args[2]) != 1) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001019 _PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001020 goto exit;
1021 }
1022 c = PyUnicode_READ_CHAR(args[2], 0);
1023 if (nargs < 4) {
1024 goto skip_optional;
1025 }
1026 if (PyFloat_Check(args[3])) {
1027 PyErr_SetString(PyExc_TypeError,
1028 "integer argument expected, got float" );
1029 goto exit;
1030 }
1031 d = _PyLong_AsInt(args[3]);
1032 if (d == -1 && PyErr_Occurred()) {
1033 goto exit;
1034 }
1035skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001036 return_value = test_int_converter_impl(module, a, b, c, d);
1037
1038exit:
1039 return return_value;
1040}
1041
1042static PyObject *
1043test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001044/*[clinic end generated code: output=10a2e48a34af5d7a input=d20541fc1ca0553e]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001045
Serhiy Storchaka31913912019-03-14 10:32:22 +02001046
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001047/*[clinic input]
1048test_unsigned_int_converter
1049
1050 a: unsigned_int = 12
1051 b: unsigned_int(bitwise=False) = 34
1052 c: unsigned_int(bitwise=True) = 56
1053 /
1054
1055[clinic start generated code]*/
1056
1057PyDoc_STRVAR(test_unsigned_int_converter__doc__,
1058"test_unsigned_int_converter($module, a=12, b=34, c=56, /)\n"
1059"--\n"
1060"\n");
1061
1062#define TEST_UNSIGNED_INT_CONVERTER_METHODDEF \
1063 {"test_unsigned_int_converter", (PyCFunction)(void(*)(void))test_unsigned_int_converter, METH_FASTCALL, test_unsigned_int_converter__doc__},
1064
1065static PyObject *
1066test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
1067 unsigned int b, unsigned int c);
1068
1069static PyObject *
1070test_unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1071{
1072 PyObject *return_value = NULL;
1073 unsigned int a = 12;
1074 unsigned int b = 34;
1075 unsigned int c = 56;
1076
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001077 if (!_PyArg_CheckPositional("test_unsigned_int_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001078 goto exit;
1079 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001080 if (nargs < 1) {
1081 goto skip_optional;
1082 }
1083 if (!_PyLong_UnsignedInt_Converter(args[0], &a)) {
1084 goto exit;
1085 }
1086 if (nargs < 2) {
1087 goto skip_optional;
1088 }
1089 if (!_PyLong_UnsignedInt_Converter(args[1], &b)) {
1090 goto exit;
1091 }
1092 if (nargs < 3) {
1093 goto skip_optional;
1094 }
1095 if (PyFloat_Check(args[2])) {
1096 PyErr_SetString(PyExc_TypeError,
1097 "integer argument expected, got float" );
1098 goto exit;
1099 }
1100 c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]);
1101 if (c == (unsigned int)-1 && PyErr_Occurred()) {
1102 goto exit;
1103 }
1104skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001105 return_value = test_unsigned_int_converter_impl(module, a, b, c);
1106
1107exit:
1108 return return_value;
1109}
1110
1111static PyObject *
1112test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
1113 unsigned int b, unsigned int c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001114/*[clinic end generated code: output=189176ce67c7d2e7 input=5533534828b62fc0]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001115
Serhiy Storchaka31913912019-03-14 10:32:22 +02001116
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001117/*[clinic input]
1118test_long_converter
1119
1120 a: long = 12
1121 /
1122
1123[clinic start generated code]*/
1124
1125PyDoc_STRVAR(test_long_converter__doc__,
1126"test_long_converter($module, a=12, /)\n"
1127"--\n"
1128"\n");
1129
1130#define TEST_LONG_CONVERTER_METHODDEF \
1131 {"test_long_converter", (PyCFunction)(void(*)(void))test_long_converter, METH_FASTCALL, test_long_converter__doc__},
1132
1133static PyObject *
1134test_long_converter_impl(PyObject *module, long a);
1135
1136static PyObject *
1137test_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1138{
1139 PyObject *return_value = NULL;
1140 long a = 12;
1141
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001142 if (!_PyArg_CheckPositional("test_long_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001143 goto exit;
1144 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001145 if (nargs < 1) {
1146 goto skip_optional;
1147 }
1148 if (PyFloat_Check(args[0])) {
1149 PyErr_SetString(PyExc_TypeError,
1150 "integer argument expected, got float" );
1151 goto exit;
1152 }
1153 a = PyLong_AsLong(args[0]);
1154 if (a == -1 && PyErr_Occurred()) {
1155 goto exit;
1156 }
1157skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001158 return_value = test_long_converter_impl(module, a);
1159
1160exit:
1161 return return_value;
1162}
1163
1164static PyObject *
1165test_long_converter_impl(PyObject *module, long a)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001166/*[clinic end generated code: output=44cd8823f59d116b input=d2179e3c9cdcde89]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001167
Serhiy Storchaka31913912019-03-14 10:32:22 +02001168
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001169/*[clinic input]
1170test_unsigned_long_converter
1171
1172 a: unsigned_long = 12
1173 b: unsigned_long(bitwise=False) = 34
1174 c: unsigned_long(bitwise=True) = 56
1175 /
1176
1177[clinic start generated code]*/
1178
1179PyDoc_STRVAR(test_unsigned_long_converter__doc__,
1180"test_unsigned_long_converter($module, a=12, b=34, c=56, /)\n"
1181"--\n"
1182"\n");
1183
1184#define TEST_UNSIGNED_LONG_CONVERTER_METHODDEF \
1185 {"test_unsigned_long_converter", (PyCFunction)(void(*)(void))test_unsigned_long_converter, METH_FASTCALL, test_unsigned_long_converter__doc__},
1186
1187static PyObject *
1188test_unsigned_long_converter_impl(PyObject *module, unsigned long a,
1189 unsigned long b, unsigned long c);
1190
1191static PyObject *
1192test_unsigned_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1193{
1194 PyObject *return_value = NULL;
1195 unsigned long a = 12;
1196 unsigned long b = 34;
1197 unsigned long c = 56;
1198
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001199 if (!_PyArg_CheckPositional("test_unsigned_long_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001200 goto exit;
1201 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001202 if (nargs < 1) {
1203 goto skip_optional;
1204 }
1205 if (!_PyLong_UnsignedLong_Converter(args[0], &a)) {
1206 goto exit;
1207 }
1208 if (nargs < 2) {
1209 goto skip_optional;
1210 }
1211 if (!_PyLong_UnsignedLong_Converter(args[1], &b)) {
1212 goto exit;
1213 }
1214 if (nargs < 3) {
1215 goto skip_optional;
1216 }
1217 if (!PyLong_Check(args[2])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001218 _PyArg_BadArgument("test_unsigned_long_converter", "argument 3", "int", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001219 goto exit;
1220 }
1221 c = PyLong_AsUnsignedLongMask(args[2]);
1222skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001223 return_value = test_unsigned_long_converter_impl(module, a, b, c);
1224
1225exit:
1226 return return_value;
1227}
1228
1229static PyObject *
1230test_unsigned_long_converter_impl(PyObject *module, unsigned long a,
1231 unsigned long b, unsigned long c)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001232/*[clinic end generated code: output=87c6b29fa217026e input=f450d94cae1ef73b]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001233
Serhiy Storchaka31913912019-03-14 10:32:22 +02001234
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001235/*[clinic input]
1236test_long_long_converter
1237
1238 a: long_long = 12
1239 /
1240
1241[clinic start generated code]*/
1242
1243PyDoc_STRVAR(test_long_long_converter__doc__,
1244"test_long_long_converter($module, a=12, /)\n"
1245"--\n"
1246"\n");
1247
1248#define TEST_LONG_LONG_CONVERTER_METHODDEF \
1249 {"test_long_long_converter", (PyCFunction)(void(*)(void))test_long_long_converter, METH_FASTCALL, test_long_long_converter__doc__},
1250
1251static PyObject *
1252test_long_long_converter_impl(PyObject *module, long long a);
1253
1254static PyObject *
1255test_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1256{
1257 PyObject *return_value = NULL;
1258 long long a = 12;
1259
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001260 if (!_PyArg_CheckPositional("test_long_long_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001261 goto exit;
1262 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001263 if (nargs < 1) {
1264 goto skip_optional;
1265 }
1266 if (PyFloat_Check(args[0])) {
1267 PyErr_SetString(PyExc_TypeError,
1268 "integer argument expected, got float" );
1269 goto exit;
1270 }
1271 a = PyLong_AsLongLong(args[0]);
1272 if (a == (PY_LONG_LONG)-1 && PyErr_Occurred()) {
1273 goto exit;
1274 }
1275skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001276 return_value = test_long_long_converter_impl(module, a);
1277
1278exit:
1279 return return_value;
1280}
1281
1282static PyObject *
1283test_long_long_converter_impl(PyObject *module, long long a)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001284/*[clinic end generated code: output=3e8083f3aee4f18a input=d5fc81577ff4dd02]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001285
Serhiy Storchaka31913912019-03-14 10:32:22 +02001286
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001287/*[clinic input]
1288test_unsigned_long_long_converter
1289
1290 a: unsigned_long_long = 12
1291 b: unsigned_long_long(bitwise=False) = 34
1292 c: unsigned_long_long(bitwise=True) = 56
1293 /
1294
1295[clinic start generated code]*/
1296
1297PyDoc_STRVAR(test_unsigned_long_long_converter__doc__,
1298"test_unsigned_long_long_converter($module, a=12, b=34, c=56, /)\n"
1299"--\n"
1300"\n");
1301
1302#define TEST_UNSIGNED_LONG_LONG_CONVERTER_METHODDEF \
1303 {"test_unsigned_long_long_converter", (PyCFunction)(void(*)(void))test_unsigned_long_long_converter, METH_FASTCALL, test_unsigned_long_long_converter__doc__},
1304
1305static PyObject *
1306test_unsigned_long_long_converter_impl(PyObject *module,
1307 unsigned long long a,
1308 unsigned long long b,
1309 unsigned long long c);
1310
1311static PyObject *
1312test_unsigned_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1313{
1314 PyObject *return_value = NULL;
1315 unsigned long long a = 12;
1316 unsigned long long b = 34;
1317 unsigned long long c = 56;
1318
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001319 if (!_PyArg_CheckPositional("test_unsigned_long_long_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001320 goto exit;
1321 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001322 if (nargs < 1) {
1323 goto skip_optional;
1324 }
1325 if (!_PyLong_UnsignedLongLong_Converter(args[0], &a)) {
1326 goto exit;
1327 }
1328 if (nargs < 2) {
1329 goto skip_optional;
1330 }
1331 if (!_PyLong_UnsignedLongLong_Converter(args[1], &b)) {
1332 goto exit;
1333 }
1334 if (nargs < 3) {
1335 goto skip_optional;
1336 }
1337 if (!PyLong_Check(args[2])) {
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001338 _PyArg_BadArgument("test_unsigned_long_long_converter", "argument 3", "int", args[2]);
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001339 goto exit;
1340 }
1341 c = PyLong_AsUnsignedLongLongMask(args[2]);
1342skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001343 return_value = test_unsigned_long_long_converter_impl(module, a, b, c);
1344
1345exit:
1346 return return_value;
1347}
1348
1349static PyObject *
1350test_unsigned_long_long_converter_impl(PyObject *module,
1351 unsigned long long a,
1352 unsigned long long b,
1353 unsigned long long c)
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03001354/*[clinic end generated code: output=aad2c7b43db2f190 input=a15115dc41866ff4]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001355
Serhiy Storchaka31913912019-03-14 10:32:22 +02001356
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001357/*[clinic input]
1358test_Py_ssize_t_converter
1359
1360 a: Py_ssize_t = 12
1361 b: Py_ssize_t(accept={int}) = 34
1362 c: Py_ssize_t(accept={int, NoneType}) = 56
1363 /
1364
1365[clinic start generated code]*/
1366
1367PyDoc_STRVAR(test_Py_ssize_t_converter__doc__,
1368"test_Py_ssize_t_converter($module, a=12, b=34, c=56, /)\n"
1369"--\n"
1370"\n");
1371
1372#define TEST_PY_SSIZE_T_CONVERTER_METHODDEF \
1373 {"test_Py_ssize_t_converter", (PyCFunction)(void(*)(void))test_Py_ssize_t_converter, METH_FASTCALL, test_Py_ssize_t_converter__doc__},
1374
1375static PyObject *
1376test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1377 Py_ssize_t c);
1378
1379static PyObject *
1380test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1381{
1382 PyObject *return_value = NULL;
1383 Py_ssize_t a = 12;
1384 Py_ssize_t b = 34;
1385 Py_ssize_t c = 56;
1386
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001387 if (!_PyArg_CheckPositional("test_Py_ssize_t_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001388 goto exit;
1389 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001390 if (nargs < 1) {
1391 goto skip_optional;
1392 }
1393 if (PyFloat_Check(args[0])) {
1394 PyErr_SetString(PyExc_TypeError,
1395 "integer argument expected, got float" );
1396 goto exit;
1397 }
1398 {
1399 Py_ssize_t ival = -1;
1400 PyObject *iobj = PyNumber_Index(args[0]);
1401 if (iobj != NULL) {
1402 ival = PyLong_AsSsize_t(iobj);
1403 Py_DECREF(iobj);
1404 }
1405 if (ival == -1 && PyErr_Occurred()) {
1406 goto exit;
1407 }
1408 a = ival;
1409 }
1410 if (nargs < 2) {
1411 goto skip_optional;
1412 }
1413 if (PyFloat_Check(args[1])) {
1414 PyErr_SetString(PyExc_TypeError,
1415 "integer argument expected, got float" );
1416 goto exit;
1417 }
1418 {
1419 Py_ssize_t ival = -1;
1420 PyObject *iobj = PyNumber_Index(args[1]);
1421 if (iobj != NULL) {
1422 ival = PyLong_AsSsize_t(iobj);
1423 Py_DECREF(iobj);
1424 }
1425 if (ival == -1 && PyErr_Occurred()) {
1426 goto exit;
1427 }
1428 b = ival;
1429 }
1430 if (nargs < 3) {
1431 goto skip_optional;
1432 }
1433 if (!_Py_convert_optional_to_ssize_t(args[2], &c)) {
1434 goto exit;
1435 }
1436skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001437 return_value = test_Py_ssize_t_converter_impl(module, a, b, c);
1438
1439exit:
1440 return return_value;
1441}
1442
1443static PyObject *
1444test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1445 Py_ssize_t c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001446/*[clinic end generated code: output=a46d2aaf40c10398 input=3855f184bb3f299d]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001447
Serhiy Storchaka31913912019-03-14 10:32:22 +02001448
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001449/*[clinic input]
1450test_slice_index_converter
1451
1452 a: slice_index = 12
1453 b: slice_index(accept={int}) = 34
1454 c: slice_index(accept={int, NoneType}) = 56
1455 /
1456
1457[clinic start generated code]*/
1458
1459PyDoc_STRVAR(test_slice_index_converter__doc__,
1460"test_slice_index_converter($module, a=12, b=34, c=56, /)\n"
1461"--\n"
1462"\n");
1463
1464#define TEST_SLICE_INDEX_CONVERTER_METHODDEF \
1465 {"test_slice_index_converter", (PyCFunction)(void(*)(void))test_slice_index_converter, METH_FASTCALL, test_slice_index_converter__doc__},
1466
1467static PyObject *
1468test_slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1469 Py_ssize_t c);
1470
1471static PyObject *
1472test_slice_index_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1473{
1474 PyObject *return_value = NULL;
1475 Py_ssize_t a = 12;
1476 Py_ssize_t b = 34;
1477 Py_ssize_t c = 56;
1478
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001479 if (!_PyArg_CheckPositional("test_slice_index_converter", nargs, 0, 3)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001480 goto exit;
1481 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001482 if (nargs < 1) {
1483 goto skip_optional;
1484 }
1485 if (!_PyEval_SliceIndex(args[0], &a)) {
1486 goto exit;
1487 }
1488 if (nargs < 2) {
1489 goto skip_optional;
1490 }
1491 if (!_PyEval_SliceIndexNotNone(args[1], &b)) {
1492 goto exit;
1493 }
1494 if (nargs < 3) {
1495 goto skip_optional;
1496 }
1497 if (!_PyEval_SliceIndex(args[2], &c)) {
1498 goto exit;
1499 }
1500skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001501 return_value = test_slice_index_converter_impl(module, a, b, c);
1502
1503exit:
1504 return return_value;
1505}
1506
1507static PyObject *
1508test_slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
1509 Py_ssize_t c)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001510/*[clinic end generated code: output=2148703cd3c6e941 input=edeadb0ee126f531]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001511
Serhiy Storchaka31913912019-03-14 10:32:22 +02001512
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001513/*[clinic input]
1514test_size_t_converter
1515
1516 a: size_t = 12
1517 /
1518
1519[clinic start generated code]*/
1520
1521PyDoc_STRVAR(test_size_t_converter__doc__,
1522"test_size_t_converter($module, a=12, /)\n"
1523"--\n"
1524"\n");
1525
1526#define TEST_SIZE_T_CONVERTER_METHODDEF \
1527 {"test_size_t_converter", (PyCFunction)(void(*)(void))test_size_t_converter, METH_FASTCALL, test_size_t_converter__doc__},
1528
1529static PyObject *
1530test_size_t_converter_impl(PyObject *module, size_t a);
1531
1532static PyObject *
1533test_size_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1534{
1535 PyObject *return_value = NULL;
1536 size_t a = 12;
1537
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001538 if (!_PyArg_CheckPositional("test_size_t_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001539 goto exit;
1540 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001541 if (nargs < 1) {
1542 goto skip_optional;
1543 }
1544 if (!_PyLong_Size_t_Converter(args[0], &a)) {
1545 goto exit;
1546 }
1547skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001548 return_value = test_size_t_converter_impl(module, a);
1549
1550exit:
1551 return return_value;
1552}
1553
1554static PyObject *
1555test_size_t_converter_impl(PyObject *module, size_t a)
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001556/*[clinic end generated code: output=8a91a9ca8a92dabb input=52e93a0fed0f1fb3]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001557
Serhiy Storchaka31913912019-03-14 10:32:22 +02001558
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001559/*[clinic input]
1560test_float_converter
1561
1562 a: float = 12.5
1563 /
1564
1565[clinic start generated code]*/
1566
1567PyDoc_STRVAR(test_float_converter__doc__,
1568"test_float_converter($module, a=12.5, /)\n"
1569"--\n"
1570"\n");
1571
1572#define TEST_FLOAT_CONVERTER_METHODDEF \
1573 {"test_float_converter", (PyCFunction)(void(*)(void))test_float_converter, METH_FASTCALL, test_float_converter__doc__},
1574
1575static PyObject *
1576test_float_converter_impl(PyObject *module, float a);
1577
1578static PyObject *
1579test_float_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1580{
1581 PyObject *return_value = NULL;
1582 float a = 12.5;
1583
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001584 if (!_PyArg_CheckPositional("test_float_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001585 goto exit;
1586 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001587 if (nargs < 1) {
1588 goto skip_optional;
1589 }
Raymond Hettinger21161d72019-08-24 19:45:12 -07001590 if (PyFloat_CheckExact(args[0])) {
1591 a = (float) (PyFloat_AS_DOUBLE(args[0]));
1592 }
1593 else
1594 {
1595 a = (float) PyFloat_AsDouble(args[0]);
1596 if (a == -1.0 && PyErr_Occurred()) {
1597 goto exit;
1598 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001599 }
1600skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001601 return_value = test_float_converter_impl(module, a);
1602
1603exit:
1604 return return_value;
1605}
1606
1607static PyObject *
1608test_float_converter_impl(PyObject *module, float a)
Raymond Hettinger21161d72019-08-24 19:45:12 -07001609/*[clinic end generated code: output=6b9c7443d2601cea input=259c0d98eca35034]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001610
Serhiy Storchaka31913912019-03-14 10:32:22 +02001611
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001612/*[clinic input]
1613test_double_converter
1614
1615 a: double = 12.5
1616 /
1617
1618[clinic start generated code]*/
1619
1620PyDoc_STRVAR(test_double_converter__doc__,
1621"test_double_converter($module, a=12.5, /)\n"
1622"--\n"
1623"\n");
1624
1625#define TEST_DOUBLE_CONVERTER_METHODDEF \
1626 {"test_double_converter", (PyCFunction)(void(*)(void))test_double_converter, METH_FASTCALL, test_double_converter__doc__},
1627
1628static PyObject *
1629test_double_converter_impl(PyObject *module, double a);
1630
1631static PyObject *
1632test_double_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1633{
1634 PyObject *return_value = NULL;
1635 double a = 12.5;
1636
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001637 if (!_PyArg_CheckPositional("test_double_converter", nargs, 0, 1)) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001638 goto exit;
1639 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001640 if (nargs < 1) {
1641 goto skip_optional;
1642 }
Raymond Hettinger21161d72019-08-24 19:45:12 -07001643 if (PyFloat_CheckExact(args[0])) {
1644 a = PyFloat_AS_DOUBLE(args[0]);
1645 }
1646 else
1647 {
1648 a = PyFloat_AsDouble(args[0]);
1649 if (a == -1.0 && PyErr_Occurred()) {
1650 goto exit;
1651 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001652 }
1653skip_optional:
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001654 return_value = test_double_converter_impl(module, a);
1655
1656exit:
1657 return return_value;
1658}
1659
1660static PyObject *
1661test_double_converter_impl(PyObject *module, double a)
Raymond Hettinger21161d72019-08-24 19:45:12 -07001662/*[clinic end generated code: output=5b7b9a0f0791b2cc input=c6a9945706a41c27]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001663
Serhiy Storchaka31913912019-03-14 10:32:22 +02001664
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001665/*[clinic input]
1666test_Py_complex_converter
1667
1668 a: Py_complex
1669 /
1670
1671[clinic start generated code]*/
1672
1673PyDoc_STRVAR(test_Py_complex_converter__doc__,
1674"test_Py_complex_converter($module, a, /)\n"
1675"--\n"
1676"\n");
1677
1678#define TEST_PY_COMPLEX_CONVERTER_METHODDEF \
1679 {"test_Py_complex_converter", (PyCFunction)test_Py_complex_converter, METH_O, test_Py_complex_converter__doc__},
1680
1681static PyObject *
1682test_Py_complex_converter_impl(PyObject *module, Py_complex a);
1683
1684static PyObject *
1685test_Py_complex_converter(PyObject *module, PyObject *arg)
1686{
1687 PyObject *return_value = NULL;
1688 Py_complex a;
1689
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001690 a = PyComplex_AsCComplex(arg);
1691 if (PyErr_Occurred()) {
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001692 goto exit;
1693 }
1694 return_value = test_Py_complex_converter_impl(module, a);
1695
1696exit:
1697 return return_value;
1698}
1699
1700static PyObject *
1701test_Py_complex_converter_impl(PyObject *module, Py_complex a)
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001702/*[clinic end generated code: output=c2ecbec2144ca540 input=070f216a515beb79]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001703
Serhiy Storchaka31913912019-03-14 10:32:22 +02001704
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001705/*[clinic input]
1706test_str_converter
1707
1708 a: str = NULL
1709 b: str = "ab"
1710 c: str(accept={str}) = "cd"
1711 d: str(accept={robuffer}) = "cef"
1712 e: str(accept={str, NoneType}) = "gh"
1713 f: str(accept={robuffer}, zeroes=True) = "ij"
1714 g: str(accept={robuffer, str}, zeroes=True) = "kl"
1715 h: str(accept={robuffer, str, NoneType}, zeroes=True) = "mn"
1716 /
1717
1718[clinic start generated code]*/
1719
1720PyDoc_STRVAR(test_str_converter__doc__,
Serhiy Storchakad322abb2019-09-14 13:31:50 +03001721"test_str_converter($module, a=<unrepresentable>, b=\'ab\', c=\'cd\',\n"
1722" d=\'cef\', e=\'gh\', f=\'ij\', g=\'kl\', h=\'mn\', /)\n"
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001723"--\n"
1724"\n");
1725
1726#define TEST_STR_CONVERTER_METHODDEF \
1727 {"test_str_converter", (PyCFunction)(void(*)(void))test_str_converter, METH_FASTCALL, test_str_converter__doc__},
1728
1729static PyObject *
1730test_str_converter_impl(PyObject *module, const char *a, const char *b,
1731 const char *c, const char *d, const char *e,
1732 const char *f, Py_ssize_clean_t f_length,
1733 const char *g, Py_ssize_clean_t g_length,
1734 const char *h, Py_ssize_clean_t h_length);
1735
1736static PyObject *
1737test_str_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1738{
1739 PyObject *return_value = NULL;
1740 const char *a = NULL;
1741 const char *b = "ab";
1742 const char *c = "cd";
1743 const char *d = "cef";
1744 const char *e = "gh";
1745 const char *f = "ij";
1746 Py_ssize_clean_t f_length;
1747 const char *g = "kl";
1748 Py_ssize_clean_t g_length;
1749 const char *h = "mn";
1750 Py_ssize_clean_t h_length;
1751
1752 if (!_PyArg_ParseStack(args, nargs, "|sssyzy#s#z#:test_str_converter",
1753 &a, &b, &c, &d, &e, &f, &f_length, &g, &g_length, &h, &h_length)) {
1754 goto exit;
1755 }
1756 return_value = test_str_converter_impl(module, a, b, c, d, e, f, f_length, g, g_length, h, h_length);
1757
1758exit:
1759 return return_value;
1760}
1761
1762static PyObject *
1763test_str_converter_impl(PyObject *module, const char *a, const char *b,
1764 const char *c, const char *d, const char *e,
1765 const char *f, Py_ssize_clean_t f_length,
1766 const char *g, Py_ssize_clean_t g_length,
1767 const char *h, Py_ssize_clean_t h_length)
Serhiy Storchakad322abb2019-09-14 13:31:50 +03001768/*[clinic end generated code: output=ad868ad94a488e32 input=8afe9da8185cd38c]*/
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001769
Serhiy Storchaka31913912019-03-14 10:32:22 +02001770
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001771/*[clinic input]
1772test_str_converter_encoding
1773
1774 a: str(encoding="idna")
1775 b: str(encoding="idna", accept={str})
1776 c: str(encoding="idna", accept={bytes, bytearray, str})
1777 d: str(encoding="idna", zeroes=True)
1778 e: str(encoding="idna", accept={bytes, bytearray, str}, zeroes=True)
1779 /
1780
1781[clinic start generated code]*/
1782
1783PyDoc_STRVAR(test_str_converter_encoding__doc__,
1784"test_str_converter_encoding($module, a, b, c, d, e, /)\n"
1785"--\n"
1786"\n");
1787
1788#define TEST_STR_CONVERTER_ENCODING_METHODDEF \
1789 {"test_str_converter_encoding", (PyCFunction)(void(*)(void))test_str_converter_encoding, METH_FASTCALL, test_str_converter_encoding__doc__},
1790
1791static PyObject *
1792test_str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c,
1793 char *d, Py_ssize_clean_t d_length, char *e,
1794 Py_ssize_clean_t e_length);
1795
1796static PyObject *
1797test_str_converter_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1798{
1799 PyObject *return_value = NULL;
1800 char *a = NULL;
1801 char *b = NULL;
1802 char *c = NULL;
1803 char *d = NULL;
1804 Py_ssize_clean_t d_length;
1805 char *e = NULL;
1806 Py_ssize_clean_t e_length;
1807
1808 if (!_PyArg_ParseStack(args, nargs, "esesetes#et#:test_str_converter_encoding",
1809 "idna", &a, "idna", &b, "idna", &c, "idna", &d, &d_length, "idna", &e, &e_length)) {
1810 goto exit;
1811 }
1812 return_value = test_str_converter_encoding_impl(module, a, b, c, d, d_length, e, e_length);
1813
1814exit:
1815 /* Cleanup for a */
1816 if (a) {
1817 PyMem_FREE(a);
1818 }
1819 /* Cleanup for b */
1820 if (b) {
1821 PyMem_FREE(b);
1822 }
1823 /* Cleanup for c */
1824 if (c) {
1825 PyMem_FREE(c);
1826 }
1827 /* Cleanup for d */
1828 if (d) {
1829 PyMem_FREE(d);
1830 }
1831 /* Cleanup for e */
1832 if (e) {
1833 PyMem_FREE(e);
1834 }
1835
1836 return return_value;
1837}
1838
1839static PyObject *
1840test_str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c,
1841 char *d, Py_ssize_clean_t d_length, char *e,
1842 Py_ssize_clean_t e_length)
1843/*[clinic end generated code: output=f579dd9e795a364e input=eb4c38e1f898f402]*/
1844
Serhiy Storchaka31913912019-03-14 10:32:22 +02001845
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001846/*[clinic input]
1847test_Py_UNICODE_converter
1848
1849 a: Py_UNICODE
1850 b: Py_UNICODE(accept={str})
1851 c: Py_UNICODE(accept={str, NoneType})
1852 d: Py_UNICODE(zeroes=True)
1853 e: Py_UNICODE(accept={str, NoneType}, zeroes=True)
1854 /
1855
1856[clinic start generated code]*/
1857
1858PyDoc_STRVAR(test_Py_UNICODE_converter__doc__,
1859"test_Py_UNICODE_converter($module, a, b, c, d, e, /)\n"
1860"--\n"
1861"\n");
1862
1863#define TEST_PY_UNICODE_CONVERTER_METHODDEF \
1864 {"test_Py_UNICODE_converter", (PyCFunction)(void(*)(void))test_Py_UNICODE_converter, METH_FASTCALL, test_Py_UNICODE_converter__doc__},
1865
1866static PyObject *
1867test_Py_UNICODE_converter_impl(PyObject *module, const Py_UNICODE *a,
1868 const Py_UNICODE *b, const Py_UNICODE *c,
1869 const Py_UNICODE *d,
1870 Py_ssize_clean_t d_length,
1871 const Py_UNICODE *e,
1872 Py_ssize_clean_t e_length);
1873
1874static PyObject *
1875test_Py_UNICODE_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1876{
1877 PyObject *return_value = NULL;
1878 const Py_UNICODE *a;
1879 const Py_UNICODE *b;
1880 const Py_UNICODE *c;
1881 const Py_UNICODE *d;
1882 Py_ssize_clean_t d_length;
1883 const Py_UNICODE *e;
1884 Py_ssize_clean_t e_length;
1885
1886 if (!_PyArg_ParseStack(args, nargs, "uuZu#Z#:test_Py_UNICODE_converter",
1887 &a, &b, &c, &d, &d_length, &e, &e_length)) {
1888 goto exit;
1889 }
1890 return_value = test_Py_UNICODE_converter_impl(module, a, b, c, d, d_length, e, e_length);
1891
1892exit:
1893 return return_value;
1894}
1895
1896static PyObject *
1897test_Py_UNICODE_converter_impl(PyObject *module, const Py_UNICODE *a,
1898 const Py_UNICODE *b, const Py_UNICODE *c,
1899 const Py_UNICODE *d,
1900 Py_ssize_clean_t d_length,
1901 const Py_UNICODE *e,
1902 Py_ssize_clean_t e_length)
1903/*[clinic end generated code: output=dd0a09a1b772e57b input=064a3b68ad7f04b0]*/
1904
Serhiy Storchaka31913912019-03-14 10:32:22 +02001905
Serhiy Storchaka837c7dc2018-12-25 10:17:28 +02001906/*[clinic input]
1907test_Py_buffer_converter
1908
1909 a: Py_buffer
1910 b: Py_buffer(accept={buffer})
1911 c: Py_buffer(accept={str, buffer})
1912 d: Py_buffer(accept={str, buffer, NoneType})
1913 e: Py_buffer(accept={rwbuffer})
1914 /
1915
1916[clinic start generated code]*/
1917
1918PyDoc_STRVAR(test_Py_buffer_converter__doc__,
1919"test_Py_buffer_converter($module, a, b, c, d, e, /)\n"
1920"--\n"
1921"\n");
1922
1923#define TEST_PY_BUFFER_CONVERTER_METHODDEF \
1924 {"test_Py_buffer_converter", (PyCFunction)(void(*)(void))test_Py_buffer_converter, METH_FASTCALL, test_Py_buffer_converter__doc__},
1925
1926static PyObject *
1927test_Py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b,
1928 Py_buffer *c, Py_buffer *d, Py_buffer *e);
1929
1930static PyObject *
1931test_Py_buffer_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1932{
1933 PyObject *return_value = NULL;
1934 Py_buffer a = {NULL, NULL};
1935 Py_buffer b = {NULL, NULL};
1936 Py_buffer c = {NULL, NULL};
1937 Py_buffer d = {NULL, NULL};
1938 Py_buffer e = {NULL, NULL};
1939
1940 if (!_PyArg_ParseStack(args, nargs, "y*y*s*z*w*:test_Py_buffer_converter",
1941 &a, &b, &c, &d, &e)) {
1942 goto exit;
1943 }
1944 return_value = test_Py_buffer_converter_impl(module, &a, &b, &c, &d, &e);
1945
1946exit:
1947 /* Cleanup for a */
1948 if (a.obj) {
1949 PyBuffer_Release(&a);
1950 }
1951 /* Cleanup for b */
1952 if (b.obj) {
1953 PyBuffer_Release(&b);
1954 }
1955 /* Cleanup for c */
1956 if (c.obj) {
1957 PyBuffer_Release(&c);
1958 }
1959 /* Cleanup for d */
1960 if (d.obj) {
1961 PyBuffer_Release(&d);
1962 }
1963 /* Cleanup for e */
1964 if (e.obj) {
1965 PyBuffer_Release(&e);
1966 }
1967
1968 return return_value;
1969}
1970
1971static PyObject *
1972test_Py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b,
1973 Py_buffer *c, Py_buffer *d, Py_buffer *e)
1974/*[clinic end generated code: output=5760c82faa2ed61f input=6a9da0f56f9525fd]*/
Serhiy Storchaka31913912019-03-14 10:32:22 +02001975
1976
1977/*[clinic input]
1978test_keywords
1979
1980 a: object
1981 b: object
1982
1983[clinic start generated code]*/
1984
1985PyDoc_STRVAR(test_keywords__doc__,
1986"test_keywords($module, /, a, b)\n"
1987"--\n"
1988"\n");
1989
1990#define TEST_KEYWORDS_METHODDEF \
1991 {"test_keywords", (PyCFunction)(void(*)(void))test_keywords, METH_FASTCALL|METH_KEYWORDS, test_keywords__doc__},
1992
1993static PyObject *
1994test_keywords_impl(PyObject *module, PyObject *a, PyObject *b);
1995
1996static PyObject *
1997test_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1998{
1999 PyObject *return_value = NULL;
2000 static const char * const _keywords[] = {"a", "b", NULL};
2001 static _PyArg_Parser _parser = {NULL, _keywords, "test_keywords", 0};
2002 PyObject *argsbuf[2];
2003 PyObject *a;
2004 PyObject *b;
2005
2006 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
2007 if (!args) {
2008 goto exit;
2009 }
2010 a = args[0];
2011 b = args[1];
2012 return_value = test_keywords_impl(module, a, b);
2013
2014exit:
2015 return return_value;
2016}
2017
2018static PyObject *
2019test_keywords_impl(PyObject *module, PyObject *a, PyObject *b)
2020/*[clinic end generated code: output=4be6cf045ea8242e input=0d3484844749c05b]*/
2021
2022
2023/*[clinic input]
2024test_keywords_kwonly
2025
2026 a: object
2027 *
2028 b: object
2029
2030[clinic start generated code]*/
2031
2032PyDoc_STRVAR(test_keywords_kwonly__doc__,
2033"test_keywords_kwonly($module, /, a, *, b)\n"
2034"--\n"
2035"\n");
2036
2037#define TEST_KEYWORDS_KWONLY_METHODDEF \
2038 {"test_keywords_kwonly", (PyCFunction)(void(*)(void))test_keywords_kwonly, METH_FASTCALL|METH_KEYWORDS, test_keywords_kwonly__doc__},
2039
2040static PyObject *
2041test_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b);
2042
2043static PyObject *
2044test_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2045{
2046 PyObject *return_value = NULL;
2047 static const char * const _keywords[] = {"a", "b", NULL};
2048 static _PyArg_Parser _parser = {NULL, _keywords, "test_keywords_kwonly", 0};
2049 PyObject *argsbuf[2];
2050 PyObject *a;
2051 PyObject *b;
2052
2053 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2054 if (!args) {
2055 goto exit;
2056 }
2057 a = args[0];
2058 b = args[1];
2059 return_value = test_keywords_kwonly_impl(module, a, b);
2060
2061exit:
2062 return return_value;
2063}
2064
2065static PyObject *
2066test_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b)
2067/*[clinic end generated code: output=d63c4977a7a80713 input=384adc78bfa0bff7]*/
2068
2069
2070/*[clinic input]
2071test_keywords_opt
2072
2073 a: object
2074 b: object = None
2075 c: object = None
2076
2077[clinic start generated code]*/
2078
2079PyDoc_STRVAR(test_keywords_opt__doc__,
2080"test_keywords_opt($module, /, a, b=None, c=None)\n"
2081"--\n"
2082"\n");
2083
2084#define TEST_KEYWORDS_OPT_METHODDEF \
2085 {"test_keywords_opt", (PyCFunction)(void(*)(void))test_keywords_opt, METH_FASTCALL|METH_KEYWORDS, test_keywords_opt__doc__},
2086
2087static PyObject *
2088test_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2089 PyObject *c);
2090
2091static PyObject *
2092test_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2093{
2094 PyObject *return_value = NULL;
2095 static const char * const _keywords[] = {"a", "b", "c", NULL};
2096 static _PyArg_Parser _parser = {NULL, _keywords, "test_keywords_opt", 0};
2097 PyObject *argsbuf[3];
2098 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2099 PyObject *a;
2100 PyObject *b = Py_None;
2101 PyObject *c = Py_None;
2102
2103 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
2104 if (!args) {
2105 goto exit;
2106 }
2107 a = args[0];
2108 if (!noptargs) {
2109 goto skip_optional_pos;
2110 }
2111 if (args[1]) {
2112 b = args[1];
2113 if (!--noptargs) {
2114 goto skip_optional_pos;
2115 }
2116 }
2117 c = args[2];
2118skip_optional_pos:
2119 return_value = test_keywords_opt_impl(module, a, b, c);
2120
2121exit:
2122 return return_value;
2123}
2124
2125static PyObject *
2126test_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2127 PyObject *c)
2128/*[clinic end generated code: output=e5e50d114d8fc10a input=eda7964f784f4607]*/
2129
2130
2131/*[clinic input]
2132test_keywords_opt_kwonly
2133
2134 a: object
2135 b: object = None
2136 *
2137 c: object = None
2138 d: object = None
2139
2140[clinic start generated code]*/
2141
2142PyDoc_STRVAR(test_keywords_opt_kwonly__doc__,
2143"test_keywords_opt_kwonly($module, /, a, b=None, *, c=None, d=None)\n"
2144"--\n"
2145"\n");
2146
2147#define TEST_KEYWORDS_OPT_KWONLY_METHODDEF \
2148 {"test_keywords_opt_kwonly", (PyCFunction)(void(*)(void))test_keywords_opt_kwonly, METH_FASTCALL|METH_KEYWORDS, test_keywords_opt_kwonly__doc__},
2149
2150static PyObject *
2151test_keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2152 PyObject *c, PyObject *d);
2153
2154static PyObject *
2155test_keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2156{
2157 PyObject *return_value = NULL;
2158 static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
2159 static _PyArg_Parser _parser = {NULL, _keywords, "test_keywords_opt_kwonly", 0};
2160 PyObject *argsbuf[4];
2161 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2162 PyObject *a;
2163 PyObject *b = Py_None;
2164 PyObject *c = Py_None;
2165 PyObject *d = Py_None;
2166
2167 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
2168 if (!args) {
2169 goto exit;
2170 }
2171 a = args[0];
2172 if (!noptargs) {
2173 goto skip_optional_pos;
2174 }
2175 if (args[1]) {
2176 b = args[1];
2177 if (!--noptargs) {
2178 goto skip_optional_pos;
2179 }
2180 }
2181skip_optional_pos:
2182 if (!noptargs) {
2183 goto skip_optional_kwonly;
2184 }
2185 if (args[2]) {
2186 c = args[2];
2187 if (!--noptargs) {
2188 goto skip_optional_kwonly;
2189 }
2190 }
2191 d = args[3];
2192skip_optional_kwonly:
2193 return_value = test_keywords_opt_kwonly_impl(module, a, b, c, d);
2194
2195exit:
2196 return return_value;
2197}
2198
2199static PyObject *
2200test_keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2201 PyObject *c, PyObject *d)
2202/*[clinic end generated code: output=3f065cb8309b9317 input=209387a4815e5082]*/
2203
2204
2205/*[clinic input]
2206test_keywords_kwonly_opt
2207
2208 a: object
2209 *
2210 b: object = None
2211 c: object = None
2212
2213[clinic start generated code]*/
2214
2215PyDoc_STRVAR(test_keywords_kwonly_opt__doc__,
2216"test_keywords_kwonly_opt($module, /, a, *, b=None, c=None)\n"
2217"--\n"
2218"\n");
2219
2220#define TEST_KEYWORDS_KWONLY_OPT_METHODDEF \
2221 {"test_keywords_kwonly_opt", (PyCFunction)(void(*)(void))test_keywords_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_keywords_kwonly_opt__doc__},
2222
2223static PyObject *
2224test_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2225 PyObject *c);
2226
2227static PyObject *
2228test_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2229{
2230 PyObject *return_value = NULL;
2231 static const char * const _keywords[] = {"a", "b", "c", NULL};
2232 static _PyArg_Parser _parser = {NULL, _keywords, "test_keywords_kwonly_opt", 0};
2233 PyObject *argsbuf[3];
2234 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2235 PyObject *a;
2236 PyObject *b = Py_None;
2237 PyObject *c = Py_None;
2238
2239 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
2240 if (!args) {
2241 goto exit;
2242 }
2243 a = args[0];
2244 if (!noptargs) {
2245 goto skip_optional_kwonly;
2246 }
2247 if (args[1]) {
2248 b = args[1];
2249 if (!--noptargs) {
2250 goto skip_optional_kwonly;
2251 }
2252 }
2253 c = args[2];
2254skip_optional_kwonly:
2255 return_value = test_keywords_kwonly_opt_impl(module, a, b, c);
2256
2257exit:
2258 return return_value;
2259}
2260
2261static PyObject *
2262test_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2263 PyObject *c)
2264/*[clinic end generated code: output=94edba5484e1681e input=18393cc64fa000f4]*/
2265
2266
2267/*[clinic input]
2268test_posonly_keywords
2269
2270 a: object
2271 /
2272 b: object
2273
2274[clinic start generated code]*/
2275
2276PyDoc_STRVAR(test_posonly_keywords__doc__,
2277"test_posonly_keywords($module, a, /, b)\n"
2278"--\n"
2279"\n");
2280
2281#define TEST_POSONLY_KEYWORDS_METHODDEF \
2282 {"test_posonly_keywords", (PyCFunction)(void(*)(void))test_posonly_keywords, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords__doc__},
2283
2284static PyObject *
2285test_posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b);
2286
2287static PyObject *
2288test_posonly_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2289{
2290 PyObject *return_value = NULL;
2291 static const char * const _keywords[] = {"", "b", NULL};
2292 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords", 0};
2293 PyObject *argsbuf[2];
2294 PyObject *a;
2295 PyObject *b;
2296
2297 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
2298 if (!args) {
2299 goto exit;
2300 }
2301 a = args[0];
2302 b = args[1];
2303 return_value = test_posonly_keywords_impl(module, a, b);
2304
2305exit:
2306 return return_value;
2307}
2308
2309static PyObject *
2310test_posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b)
2311/*[clinic end generated code: output=eca1507f0182ffb0 input=1767b0ebdf06060e]*/
2312
2313
2314/*[clinic input]
2315test_posonly_kwonly
2316
2317 a: object
2318 /
2319 *
2320 c: object
2321
2322[clinic start generated code]*/
2323
2324PyDoc_STRVAR(test_posonly_kwonly__doc__,
2325"test_posonly_kwonly($module, a, /, *, c)\n"
2326"--\n"
2327"\n");
2328
2329#define TEST_POSONLY_KWONLY_METHODDEF \
2330 {"test_posonly_kwonly", (PyCFunction)(void(*)(void))test_posonly_kwonly, METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly__doc__},
2331
2332static PyObject *
2333test_posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *c);
2334
2335static PyObject *
2336test_posonly_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2337{
2338 PyObject *return_value = NULL;
2339 static const char * const _keywords[] = {"", "c", NULL};
2340 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_kwonly", 0};
2341 PyObject *argsbuf[2];
2342 PyObject *a;
2343 PyObject *c;
2344
2345 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2346 if (!args) {
2347 goto exit;
2348 }
2349 a = args[0];
2350 c = args[1];
2351 return_value = test_posonly_kwonly_impl(module, a, c);
2352
2353exit:
2354 return return_value;
2355}
2356
2357static PyObject *
2358test_posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *c)
2359/*[clinic end generated code: output=3e14655646b66e9a input=9042f2818f664839]*/
2360
2361
2362/*[clinic input]
2363test_posonly_keywords_kwonly
2364
2365 a: object
2366 /
2367 b: object
2368 *
2369 c: object
2370
2371[clinic start generated code]*/
2372
2373PyDoc_STRVAR(test_posonly_keywords_kwonly__doc__,
2374"test_posonly_keywords_kwonly($module, a, /, b, *, c)\n"
2375"--\n"
2376"\n");
2377
2378#define TEST_POSONLY_KEYWORDS_KWONLY_METHODDEF \
2379 {"test_posonly_keywords_kwonly", (PyCFunction)(void(*)(void))test_posonly_keywords_kwonly, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly__doc__},
2380
2381static PyObject *
2382test_posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2383 PyObject *c);
2384
2385static PyObject *
2386test_posonly_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2387{
2388 PyObject *return_value = NULL;
2389 static const char * const _keywords[] = {"", "b", "c", NULL};
2390 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_kwonly", 0};
2391 PyObject *argsbuf[3];
2392 PyObject *a;
2393 PyObject *b;
2394 PyObject *c;
2395
2396 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
2397 if (!args) {
2398 goto exit;
2399 }
2400 a = args[0];
2401 b = args[1];
2402 c = args[2];
2403 return_value = test_posonly_keywords_kwonly_impl(module, a, b, c);
2404
2405exit:
2406 return return_value;
2407}
2408
2409static PyObject *
2410test_posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
2411 PyObject *c)
2412/*[clinic end generated code: output=de57172fc97a626e input=29546ebdca492fea]*/
2413
2414
2415/*[clinic input]
2416test_posonly_keywords_opt
2417
2418 a: object
2419 /
2420 b: object
2421 c: object = None
2422 d: object = None
2423
2424[clinic start generated code]*/
2425
2426PyDoc_STRVAR(test_posonly_keywords_opt__doc__,
2427"test_posonly_keywords_opt($module, a, /, b, c=None, d=None)\n"
2428"--\n"
2429"\n");
2430
2431#define TEST_POSONLY_KEYWORDS_OPT_METHODDEF \
2432 {"test_posonly_keywords_opt", (PyCFunction)(void(*)(void))test_posonly_keywords_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt__doc__},
2433
2434static PyObject *
2435test_posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2436 PyObject *c, PyObject *d);
2437
2438static PyObject *
2439test_posonly_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2440{
2441 PyObject *return_value = NULL;
2442 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
2443 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_opt", 0};
2444 PyObject *argsbuf[4];
2445 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2446 PyObject *a;
2447 PyObject *b;
2448 PyObject *c = Py_None;
2449 PyObject *d = Py_None;
2450
2451 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
2452 if (!args) {
2453 goto exit;
2454 }
2455 a = args[0];
2456 b = args[1];
2457 if (!noptargs) {
2458 goto skip_optional_pos;
2459 }
2460 if (args[2]) {
2461 c = args[2];
2462 if (!--noptargs) {
2463 goto skip_optional_pos;
2464 }
2465 }
2466 d = args[3];
2467skip_optional_pos:
2468 return_value = test_posonly_keywords_opt_impl(module, a, b, c, d);
2469
2470exit:
2471 return return_value;
2472}
2473
2474static PyObject *
2475test_posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2476 PyObject *c, PyObject *d)
2477/*[clinic end generated code: output=8bc6b44a25d4b716 input=cdf5a9625e554e9b]*/
2478
2479
2480/*[clinic input]
2481test_posonly_keywords_opt2
2482
2483 a: object
2484 /
2485 b: object = None
2486 c: object = None
2487
2488[clinic start generated code]*/
2489
2490PyDoc_STRVAR(test_posonly_keywords_opt2__doc__,
2491"test_posonly_keywords_opt2($module, a, /, b=None, c=None)\n"
2492"--\n"
2493"\n");
2494
2495#define TEST_POSONLY_KEYWORDS_OPT2_METHODDEF \
2496 {"test_posonly_keywords_opt2", (PyCFunction)(void(*)(void))test_posonly_keywords_opt2, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt2__doc__},
2497
2498static PyObject *
2499test_posonly_keywords_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2500 PyObject *c);
2501
2502static PyObject *
2503test_posonly_keywords_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2504{
2505 PyObject *return_value = NULL;
2506 static const char * const _keywords[] = {"", "b", "c", NULL};
2507 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_opt2", 0};
2508 PyObject *argsbuf[3];
2509 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2510 PyObject *a;
2511 PyObject *b = Py_None;
2512 PyObject *c = Py_None;
2513
2514 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
2515 if (!args) {
2516 goto exit;
2517 }
2518 a = args[0];
2519 if (!noptargs) {
2520 goto skip_optional_pos;
2521 }
2522 if (args[1]) {
2523 b = args[1];
2524 if (!--noptargs) {
2525 goto skip_optional_pos;
2526 }
2527 }
2528 c = args[2];
2529skip_optional_pos:
2530 return_value = test_posonly_keywords_opt2_impl(module, a, b, c);
2531
2532exit:
2533 return return_value;
2534}
2535
2536static PyObject *
2537test_posonly_keywords_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2538 PyObject *c)
2539/*[clinic end generated code: output=a870c45a6510ba91 input=1581299d21d16f14]*/
2540
2541
2542/*[clinic input]
2543test_posonly_opt_keywords_opt
2544
2545 a: object
2546 b: object = None
2547 /
2548 c: object = None
2549 d: object = None
2550
2551[clinic start generated code]*/
2552
2553PyDoc_STRVAR(test_posonly_opt_keywords_opt__doc__,
2554"test_posonly_opt_keywords_opt($module, a, b=None, /, c=None, d=None)\n"
2555"--\n"
2556"\n");
2557
2558#define TEST_POSONLY_OPT_KEYWORDS_OPT_METHODDEF \
2559 {"test_posonly_opt_keywords_opt", (PyCFunction)(void(*)(void))test_posonly_opt_keywords_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_keywords_opt__doc__},
2560
2561static PyObject *
2562test_posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a,
2563 PyObject *b, PyObject *c, PyObject *d);
2564
2565static PyObject *
2566test_posonly_opt_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2567{
2568 PyObject *return_value = NULL;
2569 static const char * const _keywords[] = {"", "", "c", "d", NULL};
2570 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_opt_keywords_opt", 0};
2571 PyObject *argsbuf[4];
2572 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2573 PyObject *a;
2574 PyObject *b = Py_None;
2575 PyObject *c = Py_None;
2576 PyObject *d = Py_None;
2577
2578 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
2579 if (!args) {
2580 goto exit;
2581 }
2582 a = args[0];
2583 if (nargs < 2) {
2584 goto skip_optional_posonly;
2585 }
2586 noptargs--;
2587 b = args[1];
2588skip_optional_posonly:
2589 if (!noptargs) {
2590 goto skip_optional_pos;
2591 }
2592 if (args[2]) {
2593 c = args[2];
2594 if (!--noptargs) {
2595 goto skip_optional_pos;
2596 }
2597 }
2598 d = args[3];
2599skip_optional_pos:
2600 return_value = test_posonly_opt_keywords_opt_impl(module, a, b, c, d);
2601
2602exit:
2603 return return_value;
2604}
2605
2606static PyObject *
2607test_posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a,
2608 PyObject *b, PyObject *c, PyObject *d)
2609/*[clinic end generated code: output=9ae3d52e071d3b7f input=408798ec3d42949f]*/
2610
2611
2612/*[clinic input]
2613test_posonly_kwonly_opt
2614
2615 a: object
2616 /
2617 *
2618 b: object
2619 c: object = None
2620 d: object = None
2621
2622[clinic start generated code]*/
2623
2624PyDoc_STRVAR(test_posonly_kwonly_opt__doc__,
2625"test_posonly_kwonly_opt($module, a, /, *, b, c=None, d=None)\n"
2626"--\n"
2627"\n");
2628
2629#define TEST_POSONLY_KWONLY_OPT_METHODDEF \
2630 {"test_posonly_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly_opt__doc__},
2631
2632static PyObject *
2633test_posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2634 PyObject *c, PyObject *d);
2635
2636static PyObject *
2637test_posonly_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2638{
2639 PyObject *return_value = NULL;
2640 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
2641 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_kwonly_opt", 0};
2642 PyObject *argsbuf[4];
2643 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2644 PyObject *a;
2645 PyObject *b;
2646 PyObject *c = Py_None;
2647 PyObject *d = Py_None;
2648
2649 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
2650 if (!args) {
2651 goto exit;
2652 }
2653 a = args[0];
2654 b = args[1];
2655 if (!noptargs) {
2656 goto skip_optional_kwonly;
2657 }
2658 if (args[2]) {
2659 c = args[2];
2660 if (!--noptargs) {
2661 goto skip_optional_kwonly;
2662 }
2663 }
2664 d = args[3];
2665skip_optional_kwonly:
2666 return_value = test_posonly_kwonly_opt_impl(module, a, b, c, d);
2667
2668exit:
2669 return return_value;
2670}
2671
2672static PyObject *
2673test_posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2674 PyObject *c, PyObject *d)
2675/*[clinic end generated code: output=fb001f586ba68549 input=8d8e5643bbbc2309]*/
2676
2677
2678/*[clinic input]
2679test_posonly_kwonly_opt2
2680
2681 a: object
2682 /
2683 *
2684 b: object = None
2685 c: object = None
2686
2687[clinic start generated code]*/
2688
2689PyDoc_STRVAR(test_posonly_kwonly_opt2__doc__,
2690"test_posonly_kwonly_opt2($module, a, /, *, b=None, c=None)\n"
2691"--\n"
2692"\n");
2693
2694#define TEST_POSONLY_KWONLY_OPT2_METHODDEF \
2695 {"test_posonly_kwonly_opt2", (PyCFunction)(void(*)(void))test_posonly_kwonly_opt2, METH_FASTCALL|METH_KEYWORDS, test_posonly_kwonly_opt2__doc__},
2696
2697static PyObject *
2698test_posonly_kwonly_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2699 PyObject *c);
2700
2701static PyObject *
2702test_posonly_kwonly_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2703{
2704 PyObject *return_value = NULL;
2705 static const char * const _keywords[] = {"", "b", "c", NULL};
2706 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_kwonly_opt2", 0};
2707 PyObject *argsbuf[3];
2708 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2709 PyObject *a;
2710 PyObject *b = Py_None;
2711 PyObject *c = Py_None;
2712
2713 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
2714 if (!args) {
2715 goto exit;
2716 }
2717 a = args[0];
2718 if (!noptargs) {
2719 goto skip_optional_kwonly;
2720 }
2721 if (args[1]) {
2722 b = args[1];
2723 if (!--noptargs) {
2724 goto skip_optional_kwonly;
2725 }
2726 }
2727 c = args[2];
2728skip_optional_kwonly:
2729 return_value = test_posonly_kwonly_opt2_impl(module, a, b, c);
2730
2731exit:
2732 return return_value;
2733}
2734
2735static PyObject *
2736test_posonly_kwonly_opt2_impl(PyObject *module, PyObject *a, PyObject *b,
2737 PyObject *c)
2738/*[clinic end generated code: output=51aae7cac77b458a input=f7e5eed94f75fff0]*/
2739
2740
2741/*[clinic input]
2742test_posonly_opt_kwonly_opt
2743
2744 a: object
2745 b: object = None
2746 /
2747 *
2748 c: object = None
2749 d: object = None
2750
2751[clinic start generated code]*/
2752
2753PyDoc_STRVAR(test_posonly_opt_kwonly_opt__doc__,
2754"test_posonly_opt_kwonly_opt($module, a, b=None, /, *, c=None, d=None)\n"
2755"--\n"
2756"\n");
2757
2758#define TEST_POSONLY_OPT_KWONLY_OPT_METHODDEF \
2759 {"test_posonly_opt_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_opt_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_kwonly_opt__doc__},
2760
2761static PyObject *
2762test_posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2763 PyObject *c, PyObject *d);
2764
2765static PyObject *
2766test_posonly_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2767{
2768 PyObject *return_value = NULL;
2769 static const char * const _keywords[] = {"", "", "c", "d", NULL};
2770 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_opt_kwonly_opt", 0};
2771 PyObject *argsbuf[4];
2772 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
2773 PyObject *a;
2774 PyObject *b = Py_None;
2775 PyObject *c = Py_None;
2776 PyObject *d = Py_None;
2777
2778 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
2779 if (!args) {
2780 goto exit;
2781 }
2782 a = args[0];
2783 if (nargs < 2) {
2784 goto skip_optional_posonly;
2785 }
2786 noptargs--;
2787 b = args[1];
2788skip_optional_posonly:
2789 if (!noptargs) {
2790 goto skip_optional_kwonly;
2791 }
2792 if (args[2]) {
2793 c = args[2];
2794 if (!--noptargs) {
2795 goto skip_optional_kwonly;
2796 }
2797 }
2798 d = args[3];
2799skip_optional_kwonly:
2800 return_value = test_posonly_opt_kwonly_opt_impl(module, a, b, c, d);
2801
2802exit:
2803 return return_value;
2804}
2805
2806static PyObject *
2807test_posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
2808 PyObject *c, PyObject *d)
2809/*[clinic end generated code: output=68844c45143d1668 input=1e557dc979d120fd]*/
2810
2811
2812/*[clinic input]
2813test_posonly_keywords_kwonly_opt
2814
2815 a: object
2816 /
2817 b: object
2818 *
2819 c: object
2820 d: object = None
2821 e: object = None
2822
2823[clinic start generated code]*/
2824
2825PyDoc_STRVAR(test_posonly_keywords_kwonly_opt__doc__,
2826"test_posonly_keywords_kwonly_opt($module, a, /, b, *, c, d=None, e=None)\n"
2827"--\n"
2828"\n");
2829
2830#define TEST_POSONLY_KEYWORDS_KWONLY_OPT_METHODDEF \
2831 {"test_posonly_keywords_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_keywords_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly_opt__doc__},
2832
2833static PyObject *
2834test_posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a,
2835 PyObject *b, PyObject *c, PyObject *d,
2836 PyObject *e);
2837
2838static PyObject *
2839test_posonly_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2840{
2841 PyObject *return_value = NULL;
2842 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
2843 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_kwonly_opt", 0};
2844 PyObject *argsbuf[5];
2845 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
2846 PyObject *a;
2847 PyObject *b;
2848 PyObject *c;
2849 PyObject *d = Py_None;
2850 PyObject *e = Py_None;
2851
2852 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
2853 if (!args) {
2854 goto exit;
2855 }
2856 a = args[0];
2857 b = args[1];
2858 c = args[2];
2859 if (!noptargs) {
2860 goto skip_optional_kwonly;
2861 }
2862 if (args[3]) {
2863 d = args[3];
2864 if (!--noptargs) {
2865 goto skip_optional_kwonly;
2866 }
2867 }
2868 e = args[4];
2869skip_optional_kwonly:
2870 return_value = test_posonly_keywords_kwonly_opt_impl(module, a, b, c, d, e);
2871
2872exit:
2873 return return_value;
2874}
2875
2876static PyObject *
2877test_posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a,
2878 PyObject *b, PyObject *c, PyObject *d,
2879 PyObject *e)
2880/*[clinic end generated code: output=996ff645551897ac input=c3884a4f956fdc89]*/
2881
2882
2883/*[clinic input]
2884test_posonly_keywords_kwonly_opt2
2885
2886 a: object
2887 /
2888 b: object
2889 *
2890 c: object = None
2891 d: object = None
2892
2893[clinic start generated code]*/
2894
2895PyDoc_STRVAR(test_posonly_keywords_kwonly_opt2__doc__,
2896"test_posonly_keywords_kwonly_opt2($module, a, /, b, *, c=None, d=None)\n"
2897"--\n"
2898"\n");
2899
2900#define TEST_POSONLY_KEYWORDS_KWONLY_OPT2_METHODDEF \
2901 {"test_posonly_keywords_kwonly_opt2", (PyCFunction)(void(*)(void))test_posonly_keywords_kwonly_opt2, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_kwonly_opt2__doc__},
2902
2903static PyObject *
2904test_posonly_keywords_kwonly_opt2_impl(PyObject *module, PyObject *a,
2905 PyObject *b, PyObject *c, PyObject *d);
2906
2907static PyObject *
2908test_posonly_keywords_kwonly_opt2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2909{
2910 PyObject *return_value = NULL;
2911 static const char * const _keywords[] = {"", "b", "c", "d", NULL};
2912 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_kwonly_opt2", 0};
2913 PyObject *argsbuf[4];
2914 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2915 PyObject *a;
2916 PyObject *b;
2917 PyObject *c = Py_None;
2918 PyObject *d = Py_None;
2919
2920 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
2921 if (!args) {
2922 goto exit;
2923 }
2924 a = args[0];
2925 b = args[1];
2926 if (!noptargs) {
2927 goto skip_optional_kwonly;
2928 }
2929 if (args[2]) {
2930 c = args[2];
2931 if (!--noptargs) {
2932 goto skip_optional_kwonly;
2933 }
2934 }
2935 d = args[3];
2936skip_optional_kwonly:
2937 return_value = test_posonly_keywords_kwonly_opt2_impl(module, a, b, c, d);
2938
2939exit:
2940 return return_value;
2941}
2942
2943static PyObject *
2944test_posonly_keywords_kwonly_opt2_impl(PyObject *module, PyObject *a,
2945 PyObject *b, PyObject *c, PyObject *d)
2946/*[clinic end generated code: output=e5a3e992fd4b28b3 input=68d01d7c0f6dafb0]*/
2947
2948
2949/*[clinic input]
2950test_posonly_keywords_opt_kwonly_opt
2951
2952 a: object
2953 /
2954 b: object
2955 c: object = None
2956 *
2957 d: object = None
2958 e: object = None
2959
2960[clinic start generated code]*/
2961
2962PyDoc_STRVAR(test_posonly_keywords_opt_kwonly_opt__doc__,
2963"test_posonly_keywords_opt_kwonly_opt($module, a, /, b, c=None, *,\n"
2964" d=None, e=None)\n"
2965"--\n"
2966"\n");
2967
2968#define TEST_POSONLY_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
2969 {"test_posonly_keywords_opt_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_keywords_opt_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt_kwonly_opt__doc__},
2970
2971static PyObject *
2972test_posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
2973 PyObject *b, PyObject *c,
2974 PyObject *d, PyObject *e);
2975
2976static PyObject *
2977test_posonly_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
2978{
2979 PyObject *return_value = NULL;
2980 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
2981 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_opt_kwonly_opt", 0};
2982 PyObject *argsbuf[5];
2983 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
2984 PyObject *a;
2985 PyObject *b;
2986 PyObject *c = Py_None;
2987 PyObject *d = Py_None;
2988 PyObject *e = Py_None;
2989
2990 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
2991 if (!args) {
2992 goto exit;
2993 }
2994 a = args[0];
2995 b = args[1];
2996 if (!noptargs) {
2997 goto skip_optional_pos;
2998 }
2999 if (args[2]) {
3000 c = args[2];
3001 if (!--noptargs) {
3002 goto skip_optional_pos;
3003 }
3004 }
3005skip_optional_pos:
3006 if (!noptargs) {
3007 goto skip_optional_kwonly;
3008 }
3009 if (args[3]) {
3010 d = args[3];
3011 if (!--noptargs) {
3012 goto skip_optional_kwonly;
3013 }
3014 }
3015 e = args[4];
3016skip_optional_kwonly:
3017 return_value = test_posonly_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e);
3018
3019exit:
3020 return return_value;
3021}
3022
3023static PyObject *
3024test_posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3025 PyObject *b, PyObject *c,
3026 PyObject *d, PyObject *e)
3027/*[clinic end generated code: output=ff9fb6c3d2cbbaa4 input=d0883d45876f186c]*/
3028
3029
3030/*[clinic input]
3031test_posonly_keywords_opt2_kwonly_opt
3032
3033 a: object
3034 /
3035 b: object = None
3036 c: object = None
3037 *
3038 d: object = None
3039 e: object = None
3040
3041[clinic start generated code]*/
3042
3043PyDoc_STRVAR(test_posonly_keywords_opt2_kwonly_opt__doc__,
3044"test_posonly_keywords_opt2_kwonly_opt($module, a, /, b=None, c=None, *,\n"
3045" d=None, e=None)\n"
3046"--\n"
3047"\n");
3048
3049#define TEST_POSONLY_KEYWORDS_OPT2_KWONLY_OPT_METHODDEF \
3050 {"test_posonly_keywords_opt2_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_keywords_opt2_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_keywords_opt2_kwonly_opt__doc__},
3051
3052static PyObject *
3053test_posonly_keywords_opt2_kwonly_opt_impl(PyObject *module, PyObject *a,
3054 PyObject *b, PyObject *c,
3055 PyObject *d, PyObject *e);
3056
3057static PyObject *
3058test_posonly_keywords_opt2_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3059{
3060 PyObject *return_value = NULL;
3061 static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
3062 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_keywords_opt2_kwonly_opt", 0};
3063 PyObject *argsbuf[5];
3064 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
3065 PyObject *a;
3066 PyObject *b = Py_None;
3067 PyObject *c = Py_None;
3068 PyObject *d = Py_None;
3069 PyObject *e = Py_None;
3070
3071 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
3072 if (!args) {
3073 goto exit;
3074 }
3075 a = args[0];
3076 if (!noptargs) {
3077 goto skip_optional_pos;
3078 }
3079 if (args[1]) {
3080 b = args[1];
3081 if (!--noptargs) {
3082 goto skip_optional_pos;
3083 }
3084 }
3085 if (args[2]) {
3086 c = args[2];
3087 if (!--noptargs) {
3088 goto skip_optional_pos;
3089 }
3090 }
3091skip_optional_pos:
3092 if (!noptargs) {
3093 goto skip_optional_kwonly;
3094 }
3095 if (args[3]) {
3096 d = args[3];
3097 if (!--noptargs) {
3098 goto skip_optional_kwonly;
3099 }
3100 }
3101 e = args[4];
3102skip_optional_kwonly:
3103 return_value = test_posonly_keywords_opt2_kwonly_opt_impl(module, a, b, c, d, e);
3104
3105exit:
3106 return return_value;
3107}
3108
3109static PyObject *
3110test_posonly_keywords_opt2_kwonly_opt_impl(PyObject *module, PyObject *a,
3111 PyObject *b, PyObject *c,
3112 PyObject *d, PyObject *e)
3113/*[clinic end generated code: output=c809d7a84a2205e1 input=c95e2e1ec93035ad]*/
3114
3115
3116/*[clinic input]
3117test_posonly_opt_keywords_opt_kwonly_opt
3118
3119 a: object
3120 b: object = None
3121 /
3122 c: object = None
3123 d: object = None
3124 *
3125 e: object = None
3126 f: object = None
3127
3128[clinic start generated code]*/
3129
3130PyDoc_STRVAR(test_posonly_opt_keywords_opt_kwonly_opt__doc__,
3131"test_posonly_opt_keywords_opt_kwonly_opt($module, a, b=None, /, c=None,\n"
3132" d=None, *, e=None, f=None)\n"
3133"--\n"
3134"\n");
3135
3136#define TEST_POSONLY_OPT_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
3137 {"test_posonly_opt_keywords_opt_kwonly_opt", (PyCFunction)(void(*)(void))test_posonly_opt_keywords_opt_kwonly_opt, METH_FASTCALL|METH_KEYWORDS, test_posonly_opt_keywords_opt_kwonly_opt__doc__},
3138
3139static PyObject *
3140test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3141 PyObject *b, PyObject *c,
3142 PyObject *d, PyObject *e,
3143 PyObject *f);
3144
3145static PyObject *
3146test_posonly_opt_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3147{
3148 PyObject *return_value = NULL;
3149 static const char * const _keywords[] = {"", "", "c", "d", "e", "f", NULL};
3150 static _PyArg_Parser _parser = {NULL, _keywords, "test_posonly_opt_keywords_opt_kwonly_opt", 0};
3151 PyObject *argsbuf[6];
3152 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
3153 PyObject *a;
3154 PyObject *b = Py_None;
3155 PyObject *c = Py_None;
3156 PyObject *d = Py_None;
3157 PyObject *e = Py_None;
3158 PyObject *f = Py_None;
3159
3160 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
3161 if (!args) {
3162 goto exit;
3163 }
3164 a = args[0];
3165 if (nargs < 2) {
3166 goto skip_optional_posonly;
3167 }
3168 noptargs--;
3169 b = args[1];
3170skip_optional_posonly:
3171 if (!noptargs) {
3172 goto skip_optional_pos;
3173 }
3174 if (args[2]) {
3175 c = args[2];
3176 if (!--noptargs) {
3177 goto skip_optional_pos;
3178 }
3179 }
3180 if (args[3]) {
3181 d = args[3];
3182 if (!--noptargs) {
3183 goto skip_optional_pos;
3184 }
3185 }
3186skip_optional_pos:
3187 if (!noptargs) {
3188 goto skip_optional_kwonly;
3189 }
3190 if (args[4]) {
3191 e = args[4];
3192 if (!--noptargs) {
3193 goto skip_optional_kwonly;
3194 }
3195 }
3196 f = args[5];
3197skip_optional_kwonly:
3198 return_value = test_posonly_opt_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e, f);
3199
3200exit:
3201 return return_value;
3202}
3203
3204static PyObject *
3205test_posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
3206 PyObject *b, PyObject *c,
3207 PyObject *d, PyObject *e,
3208 PyObject *f)
3209/*[clinic end generated code: output=719e4f6c224402d4 input=9914857713c5bbf8]*/
Serhiy Storchaka96631dc2019-08-29 18:29:59 +03003210
3211/*[clinic input]
3212test_keyword_only_parameter
3213
3214
3215 *
3216 co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
3217
3218[clinic start generated code]*/
3219
3220PyDoc_STRVAR(test_keyword_only_parameter__doc__,
3221"test_keyword_only_parameter($module, /, *, co_lnotab=None)\n"
3222"--\n"
3223"\n");
3224
3225#define TEST_KEYWORD_ONLY_PARAMETER_METHODDEF \
3226 {"test_keyword_only_parameter", (PyCFunction)(void(*)(void))test_keyword_only_parameter, METH_FASTCALL|METH_KEYWORDS, test_keyword_only_parameter__doc__},
3227
3228static PyObject *
3229test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab);
3230
3231static PyObject *
3232test_keyword_only_parameter(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
3233{
3234 PyObject *return_value = NULL;
3235 static const char * const _keywords[] = {"co_lnotab", NULL};
3236 static _PyArg_Parser _parser = {NULL, _keywords, "test_keyword_only_parameter", 0};
3237 PyObject *argsbuf[1];
3238 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
3239 PyBytesObject *co_lnotab = (PyBytesObject *)self->co_lnotab;
3240
3241 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
3242 if (!args) {
3243 goto exit;
3244 }
3245 if (!noptargs) {
3246 goto skip_optional_kwonly;
3247 }
3248 if (!PyBytes_Check(args[0])) {
3249 _PyArg_BadArgument("test_keyword_only_parameter", "argument 'co_lnotab'", "bytes", args[0]);
3250 goto exit;
3251 }
3252 co_lnotab = (PyBytesObject *)args[0];
3253skip_optional_kwonly:
3254 return_value = test_keyword_only_parameter_impl(module, co_lnotab);
3255
3256exit:
3257 return return_value;
3258}
3259
3260static PyObject *
3261test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab)
3262/*[clinic end generated code: output=f25914b402039493 input=303df5046c7e37a3]*/