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