| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 6 |
# include "pycore_gc.h" // PyGC_Head |
| 7 |
#endif |
| 8 |
#include "pycore_abstract.h" // _PyNumber_Index() |
| 9 |
#include "pycore_long.h" // _PyLong_UnsignedShort_Converter() |
| 10 |
#include "pycore_modsupport.h" // _PyArg_CheckPositional() |
| 11 |
#include "pycore_runtime.h" // _Py_ID() |
| 12 |
|
| 13 |
PyDoc_STRVAR(test_empty_function__doc__, |
| 14 |
"test_empty_function($module, /)\n" |
| 15 |
"--\n" |
| 16 |
"\n"); |
| 17 |
|
| 18 |
#define TEST_EMPTY_FUNCTION_METHODDEF \ |
| 19 |
{"test_empty_function", (PyCFunction)test_empty_function, METH_NOARGS, test_empty_function__doc__}, |
| 20 |
|
| 21 |
static PyObject * |
| 22 |
test_empty_function_impl(PyObject *module); |
| 23 |
|
| 24 |
static PyObject * |
| 25 |
test_empty_function(PyObject *module, PyObject *Py_UNUSED(ignored)) |
| 26 |
{ |
| 27 |
return test_empty_function_impl(module); |
| 28 |
} |
| 29 |
|
| 30 |
PyDoc_STRVAR(objects_converter__doc__, |
| 31 |
"objects_converter($module, a, b=<unrepresentable>, /)\n" |
| 32 |
"--\n" |
| 33 |
"\n"); |
| 34 |
|
| 35 |
#define OBJECTS_CONVERTER_METHODDEF \ |
| 36 |
{"objects_converter", _PyCFunction_CAST(objects_converter), METH_FASTCALL, objects_converter__doc__}, |
| 37 |
|
| 38 |
static PyObject * |
| 39 |
objects_converter_impl(PyObject *module, PyObject *a, PyObject *b); |
| 40 |
|
| 41 |
static PyObject * |
| 42 |
objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 43 |
{ |
| 44 |
PyObject *return_value = NULL; |
| 45 |
PyObject *a; |
| 46 |
PyObject *b = NULL; |
| 47 |
|
| 48 |
if (!_PyArg_CheckPositional("objects_converter", nargs, 1, 2)) { |
| 49 |
goto exit; |
| 50 |
} |
| 51 |
a = args[0]; |
| 52 |
if (nargs < 2) { |
| 53 |
goto skip_optional; |
| 54 |
} |
| 55 |
b = args[1]; |
| 56 |
skip_optional: |
| 57 |
return_value = objects_converter_impl(module, a, b); |
| 58 |
|
| 59 |
exit: |
| 60 |
return return_value; |
| 61 |
} |
| 62 |
|
| 63 |
PyDoc_STRVAR(bytes_object_converter__doc__, |
| 64 |
"bytes_object_converter($module, a, /)\n" |
| 65 |
"--\n" |
| 66 |
"\n"); |
| 67 |
|
| 68 |
#define BYTES_OBJECT_CONVERTER_METHODDEF \ |
| 69 |
{"bytes_object_converter", (PyCFunction)bytes_object_converter, METH_O, bytes_object_converter__doc__}, |
| 70 |
|
| 71 |
static PyObject * |
| 72 |
bytes_object_converter_impl(PyObject *module, PyBytesObject *a); |
| 73 |
|
| 74 |
static PyObject * |
| 75 |
bytes_object_converter(PyObject *module, PyObject *arg) |
| 76 |
{ |
| 77 |
PyObject *return_value = NULL; |
| 78 |
PyBytesObject *a; |
| 79 |
|
| 80 |
if (!PyBytes_Check(arg)) { |
| 81 |
_PyArg_BadArgument("bytes_object_converter", "argument", "bytes", arg); |
| 82 |
goto exit; |
| 83 |
} |
| 84 |
a = (PyBytesObject *)arg; |
| 85 |
return_value = bytes_object_converter_impl(module, a); |
| 86 |
|
| 87 |
exit: |
| 88 |
return return_value; |
| 89 |
} |
| 90 |
|
| 91 |
PyDoc_STRVAR(byte_array_object_converter__doc__, |
| 92 |
"byte_array_object_converter($module, a, /)\n" |
| 93 |
"--\n" |
| 94 |
"\n"); |
| 95 |
|
| 96 |
#define BYTE_ARRAY_OBJECT_CONVERTER_METHODDEF \ |
| 97 |
{"byte_array_object_converter", (PyCFunction)byte_array_object_converter, METH_O, byte_array_object_converter__doc__}, |
| 98 |
|
| 99 |
static PyObject * |
| 100 |
byte_array_object_converter_impl(PyObject *module, PyByteArrayObject *a); |
| 101 |
|
| 102 |
static PyObject * |
| 103 |
byte_array_object_converter(PyObject *module, PyObject *arg) |
| 104 |
{ |
| 105 |
PyObject *return_value = NULL; |
| 106 |
PyByteArrayObject *a; |
| 107 |
|
| 108 |
if (!PyByteArray_Check(arg)) { |
| 109 |
_PyArg_BadArgument("byte_array_object_converter", "argument", "bytearray", arg); |
| 110 |
goto exit; |
| 111 |
} |
| 112 |
a = (PyByteArrayObject *)arg; |
| 113 |
return_value = byte_array_object_converter_impl(module, a); |
| 114 |
|
| 115 |
exit: |
| 116 |
return return_value; |
| 117 |
} |
| 118 |
|
| 119 |
PyDoc_STRVAR(unicode_converter__doc__, |
| 120 |
"unicode_converter($module, a, /)\n" |
| 121 |
"--\n" |
| 122 |
"\n"); |
| 123 |
|
| 124 |
#define UNICODE_CONVERTER_METHODDEF \ |
| 125 |
{"unicode_converter", (PyCFunction)unicode_converter, METH_O, unicode_converter__doc__}, |
| 126 |
|
| 127 |
static PyObject * |
| 128 |
unicode_converter_impl(PyObject *module, PyObject *a); |
| 129 |
|
| 130 |
static PyObject * |
| 131 |
unicode_converter(PyObject *module, PyObject *arg) |
| 132 |
{ |
| 133 |
PyObject *return_value = NULL; |
| 134 |
PyObject *a; |
| 135 |
|
| 136 |
if (!PyUnicode_Check(arg)) { |
| 137 |
_PyArg_BadArgument("unicode_converter", "argument", "str", arg); |
| 138 |
goto exit; |
| 139 |
} |
| 140 |
a = arg; |
| 141 |
return_value = unicode_converter_impl(module, a); |
| 142 |
|
| 143 |
exit: |
| 144 |
return return_value; |
| 145 |
} |
| 146 |
|
| 147 |
PyDoc_STRVAR(bool_converter__doc__, |
| 148 |
"bool_converter($module, a=True, b=True, c=True, /)\n" |
| 149 |
"--\n" |
| 150 |
"\n"); |
| 151 |
|
| 152 |
#define BOOL_CONVERTER_METHODDEF \ |
| 153 |
{"bool_converter", _PyCFunction_CAST(bool_converter), METH_FASTCALL, bool_converter__doc__}, |
| 154 |
|
| 155 |
static PyObject * |
| 156 |
bool_converter_impl(PyObject *module, int a, int b, int c); |
| 157 |
|
| 158 |
static PyObject * |
| 159 |
bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 160 |
{ |
| 161 |
PyObject *return_value = NULL; |
| 162 |
int a = 1; |
| 163 |
int b = 1; |
| 164 |
int c = 1; |
| 165 |
|
| 166 |
if (!_PyArg_CheckPositional("bool_converter", nargs, 0, 3)) { |
| 167 |
goto exit; |
| 168 |
} |
| 169 |
if (nargs < 1) { |
| 170 |
goto skip_optional; |
| 171 |
} |
| 172 |
a = PyObject_IsTrue(args[0]); |
| 173 |
if (a < 0) { |
| 174 |
goto exit; |
| 175 |
} |
| 176 |
if (nargs < 2) { |
| 177 |
goto skip_optional; |
| 178 |
} |
| 179 |
b = PyObject_IsTrue(args[1]); |
| 180 |
if (b < 0) { |
| 181 |
goto exit; |
| 182 |
} |
| 183 |
if (nargs < 3) { |
| 184 |
goto skip_optional; |
| 185 |
} |
| 186 |
c = PyLong_AsInt(args[2]); |
| 187 |
if (c == -1 && PyErr_Occurred()) { |
| 188 |
goto exit; |
| 189 |
} |
| 190 |
skip_optional: |
| 191 |
return_value = bool_converter_impl(module, a, b, c); |
| 192 |
|
| 193 |
exit: |
| 194 |
return return_value; |
| 195 |
} |
| 196 |
|
| 197 |
PyDoc_STRVAR(bool_converter_c_default__doc__, |
| 198 |
"bool_converter_c_default($module, a=True, b=False, c=True, d=x, /)\n" |
| 199 |
"--\n" |
| 200 |
"\n"); |
| 201 |
|
| 202 |
#define BOOL_CONVERTER_C_DEFAULT_METHODDEF \ |
| 203 |
{"bool_converter_c_default", _PyCFunction_CAST(bool_converter_c_default), METH_FASTCALL, bool_converter_c_default__doc__}, |
| 204 |
|
| 205 |
static PyObject * |
| 206 |
bool_converter_c_default_impl(PyObject *module, int a, int b, int c, int d); |
| 207 |
|
| 208 |
static PyObject * |
| 209 |
bool_converter_c_default(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 210 |
{ |
| 211 |
PyObject *return_value = NULL; |
| 212 |
int a = 1; |
| 213 |
int b = 0; |
| 214 |
int c = -2; |
| 215 |
int d = -3; |
| 216 |
|
| 217 |
if (!_PyArg_CheckPositional("bool_converter_c_default", nargs, 0, 4)) { |
| 218 |
goto exit; |
| 219 |
} |
| 220 |
if (nargs < 1) { |
| 221 |
goto skip_optional; |
| 222 |
} |
| 223 |
a = PyObject_IsTrue(args[0]); |
| 224 |
if (a < 0) { |
| 225 |
goto exit; |
| 226 |
} |
| 227 |
if (nargs < 2) { |
| 228 |
goto skip_optional; |
| 229 |
} |
| 230 |
b = PyObject_IsTrue(args[1]); |
| 231 |
if (b < 0) { |
| 232 |
goto exit; |
| 233 |
} |
| 234 |
if (nargs < 3) { |
| 235 |
goto skip_optional; |
| 236 |
} |
| 237 |
c = PyObject_IsTrue(args[2]); |
| 238 |
if (c < 0) { |
| 239 |
goto exit; |
| 240 |
} |
| 241 |
if (nargs < 4) { |
| 242 |
goto skip_optional; |
| 243 |
} |
| 244 |
d = PyObject_IsTrue(args[3]); |
| 245 |
if (d < 0) { |
| 246 |
goto exit; |
| 247 |
} |
| 248 |
skip_optional: |
| 249 |
return_value = bool_converter_c_default_impl(module, a, b, c, d); |
| 250 |
|
| 251 |
exit: |
| 252 |
return return_value; |
| 253 |
} |
| 254 |
|
| 255 |
PyDoc_STRVAR(char_converter__doc__, |
| 256 |
"char_converter($module, a=b\'A\', b=b\'\\x07\', c=b\'\\x08\', d=b\'\\t\', e=b\'\\n\',\n" |
| 257 |
" f=b\'\\x0b\', g=b\'\\x0c\', h=b\'\\r\', i=b\'\"\', j=b\"\'\", k=b\'?\',\n" |
| 258 |
" l=b\'\\\\\', m=b\'\\x00\', n=b\'\\xff\', /)\n" |
| 259 |
"--\n" |
| 260 |
"\n"); |
| 261 |
|
| 262 |
#define CHAR_CONVERTER_METHODDEF \ |
| 263 |
{"char_converter", _PyCFunction_CAST(char_converter), METH_FASTCALL, char_converter__doc__}, |
| 264 |
|
| 265 |
static PyObject * |
| 266 |
char_converter_impl(PyObject *module, char a, char b, char c, char d, char e, |
| 267 |
char f, char g, char h, char i, char j, char k, char l, |
| 268 |
char m, char n); |
| 269 |
|
| 270 |
static PyObject * |
| 271 |
char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 272 |
{ |
| 273 |
PyObject *return_value = NULL; |
| 274 |
char a = 'A'; |
| 275 |
char b = '\x07'; |
| 276 |
char c = '\x08'; |
| 277 |
char d = '\t'; |
| 278 |
char e = '\n'; |
| 279 |
char f = '\x0b'; |
| 280 |
char g = '\x0c'; |
| 281 |
char h = '\r'; |
| 282 |
char i = '"'; |
| 283 |
char j = '\''; |
| 284 |
char k = '?'; |
| 285 |
char l = '\\'; |
| 286 |
char m = '\x00'; |
| 287 |
char n = '\xff'; |
| 288 |
|
| 289 |
if (!_PyArg_CheckPositional("char_converter", nargs, 0, 14)) { |
| 290 |
goto exit; |
| 291 |
} |
| 292 |
if (nargs < 1) { |
| 293 |
goto skip_optional; |
| 294 |
} |
| 295 |
if (PyBytes_Check(args[0]) && PyBytes_GET_SIZE(args[0]) == 1) { |
| 296 |
a = PyBytes_AS_STRING(args[0])[0]; |
| 297 |
} |
| 298 |
else if (PyByteArray_Check(args[0]) && PyByteArray_GET_SIZE(args[0]) == 1) { |
| 299 |
a = PyByteArray_AS_STRING(args[0])[0]; |
| 300 |
} |
| 301 |
else { |
| 302 |
_PyArg_BadArgument("char_converter", "argument 1", "a byte string of length 1", args[0]); |
| 303 |
goto exit; |
| 304 |
} |
| 305 |
if (nargs < 2) { |
| 306 |
goto skip_optional; |
| 307 |
} |
| 308 |
if (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { |
| 309 |
b = PyBytes_AS_STRING(args[1])[0]; |
| 310 |
} |
| 311 |
else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { |
| 312 |
b = PyByteArray_AS_STRING(args[1])[0]; |
| 313 |
} |
| 314 |
else { |
| 315 |
_PyArg_BadArgument("char_converter", "argument 2", "a byte string of length 1", args[1]); |
| 316 |
goto exit; |
| 317 |
} |
| 318 |
if (nargs < 3) { |
| 319 |
goto skip_optional; |
| 320 |
} |
| 321 |
if (PyBytes_Check(args[2]) && PyBytes_GET_SIZE(args[2]) == 1) { |
| 322 |
c = PyBytes_AS_STRING(args[2])[0]; |
| 323 |
} |
| 324 |
else if (PyByteArray_Check(args[2]) && PyByteArray_GET_SIZE(args[2]) == 1) { |
| 325 |
c = PyByteArray_AS_STRING(args[2])[0]; |
| 326 |
} |
| 327 |
else { |
| 328 |
_PyArg_BadArgument("char_converter", "argument 3", "a byte string of length 1", args[2]); |
| 329 |
goto exit; |
| 330 |
} |
| 331 |
if (nargs < 4) { |
| 332 |
goto skip_optional; |
| 333 |
} |
| 334 |
if (PyBytes_Check(args[3]) && PyBytes_GET_SIZE(args[3]) == 1) { |
| 335 |
d = PyBytes_AS_STRING(args[3])[0]; |
| 336 |
} |
| 337 |
else if (PyByteArray_Check(args[3]) && PyByteArray_GET_SIZE(args[3]) == 1) { |
| 338 |
d = PyByteArray_AS_STRING(args[3])[0]; |
| 339 |
} |
| 340 |
else { |
| 341 |
_PyArg_BadArgument("char_converter", "argument 4", "a byte string of length 1", args[3]); |
| 342 |
goto exit; |
| 343 |
} |
| 344 |
if (nargs < 5) { |
| 345 |
goto skip_optional; |
| 346 |
} |
| 347 |
if (PyBytes_Check(args[4]) && PyBytes_GET_SIZE(args[4]) == 1) { |
| 348 |
e = PyBytes_AS_STRING(args[4])[0]; |
| 349 |
} |
| 350 |
else if (PyByteArray_Check(args[4]) && PyByteArray_GET_SIZE(args[4]) == 1) { |
| 351 |
e = PyByteArray_AS_STRING(args[4])[0]; |
| 352 |
} |
| 353 |
else { |
| 354 |
_PyArg_BadArgument("char_converter", "argument 5", "a byte string of length 1", args[4]); |
| 355 |
goto exit; |
| 356 |
} |
| 357 |
if (nargs < 6) { |
| 358 |
goto skip_optional; |
| 359 |
} |
| 360 |
if (PyBytes_Check(args[5]) && PyBytes_GET_SIZE(args[5]) == 1) { |
| 361 |
f = PyBytes_AS_STRING(args[5])[0]; |
| 362 |
} |
| 363 |
else if (PyByteArray_Check(args[5]) && PyByteArray_GET_SIZE(args[5]) == 1) { |
| 364 |
f = PyByteArray_AS_STRING(args[5])[0]; |
| 365 |
} |
| 366 |
else { |
| 367 |
_PyArg_BadArgument("char_converter", "argument 6", "a byte string of length 1", args[5]); |
| 368 |
goto exit; |
| 369 |
} |
| 370 |
if (nargs < 7) { |
| 371 |
goto skip_optional; |
| 372 |
} |
| 373 |
if (PyBytes_Check(args[6]) && PyBytes_GET_SIZE(args[6]) == 1) { |
| 374 |
g = PyBytes_AS_STRING(args[6])[0]; |
| 375 |
} |
| 376 |
else if (PyByteArray_Check(args[6]) && PyByteArray_GET_SIZE(args[6]) == 1) { |
| 377 |
g = PyByteArray_AS_STRING(args[6])[0]; |
| 378 |
} |
| 379 |
else { |
| 380 |
_PyArg_BadArgument("char_converter", "argument 7", "a byte string of length 1", args[6]); |
| 381 |
goto exit; |
| 382 |
} |
| 383 |
if (nargs < 8) { |
| 384 |
goto skip_optional; |
| 385 |
} |
| 386 |
if (PyBytes_Check(args[7]) && PyBytes_GET_SIZE(args[7]) == 1) { |
| 387 |
h = PyBytes_AS_STRING(args[7])[0]; |
| 388 |
} |
| 389 |
else if (PyByteArray_Check(args[7]) && PyByteArray_GET_SIZE(args[7]) == 1) { |
| 390 |
h = PyByteArray_AS_STRING(args[7])[0]; |
| 391 |
} |
| 392 |
else { |
| 393 |
_PyArg_BadArgument("char_converter", "argument 8", "a byte string of length 1", args[7]); |
| 394 |
goto exit; |
| 395 |
} |
| 396 |
if (nargs < 9) { |
| 397 |
goto skip_optional; |
| 398 |
} |
| 399 |
if (PyBytes_Check(args[8]) && PyBytes_GET_SIZE(args[8]) == 1) { |
| 400 |
i = PyBytes_AS_STRING(args[8])[0]; |
| 401 |
} |
| 402 |
else if (PyByteArray_Check(args[8]) && PyByteArray_GET_SIZE(args[8]) == 1) { |
| 403 |
i = PyByteArray_AS_STRING(args[8])[0]; |
| 404 |
} |
| 405 |
else { |
| 406 |
_PyArg_BadArgument("char_converter", "argument 9", "a byte string of length 1", args[8]); |
| 407 |
goto exit; |
| 408 |
} |
| 409 |
if (nargs < 10) { |
| 410 |
goto skip_optional; |
| 411 |
} |
| 412 |
if (PyBytes_Check(args[9]) && PyBytes_GET_SIZE(args[9]) == 1) { |
| 413 |
j = PyBytes_AS_STRING(args[9])[0]; |
| 414 |
} |
| 415 |
else if (PyByteArray_Check(args[9]) && PyByteArray_GET_SIZE(args[9]) == 1) { |
| 416 |
j = PyByteArray_AS_STRING(args[9])[0]; |
| 417 |
} |
| 418 |
else { |
| 419 |
_PyArg_BadArgument("char_converter", "argument 10", "a byte string of length 1", args[9]); |
| 420 |
goto exit; |
| 421 |
} |
| 422 |
if (nargs < 11) { |
| 423 |
goto skip_optional; |
| 424 |
} |
| 425 |
if (PyBytes_Check(args[10]) && PyBytes_GET_SIZE(args[10]) == 1) { |
| 426 |
k = PyBytes_AS_STRING(args[10])[0]; |
| 427 |
} |
| 428 |
else if (PyByteArray_Check(args[10]) && PyByteArray_GET_SIZE(args[10]) == 1) { |
| 429 |
k = PyByteArray_AS_STRING(args[10])[0]; |
| 430 |
} |
| 431 |
else { |
| 432 |
_PyArg_BadArgument("char_converter", "argument 11", "a byte string of length 1", args[10]); |
| 433 |
goto exit; |
| 434 |
} |
| 435 |
if (nargs < 12) { |
| 436 |
goto skip_optional; |
| 437 |
} |
| 438 |
if (PyBytes_Check(args[11]) && PyBytes_GET_SIZE(args[11]) == 1) { |
| 439 |
l = PyBytes_AS_STRING(args[11])[0]; |
| 440 |
} |
| 441 |
else if (PyByteArray_Check(args[11]) && PyByteArray_GET_SIZE(args[11]) == 1) { |
| 442 |
l = PyByteArray_AS_STRING(args[11])[0]; |
| 443 |
} |
| 444 |
else { |
| 445 |
_PyArg_BadArgument("char_converter", "argument 12", "a byte string of length 1", args[11]); |
| 446 |
goto exit; |
| 447 |
} |
| 448 |
if (nargs < 13) { |
| 449 |
goto skip_optional; |
| 450 |
} |
| 451 |
if (PyBytes_Check(args[12]) && PyBytes_GET_SIZE(args[12]) == 1) { |
| 452 |
m = PyBytes_AS_STRING(args[12])[0]; |
| 453 |
} |
| 454 |
else if (PyByteArray_Check(args[12]) && PyByteArray_GET_SIZE(args[12]) == 1) { |
| 455 |
m = PyByteArray_AS_STRING(args[12])[0]; |
| 456 |
} |
| 457 |
else { |
| 458 |
_PyArg_BadArgument("char_converter", "argument 13", "a byte string of length 1", args[12]); |
| 459 |
goto exit; |
| 460 |
} |
| 461 |
if (nargs < 14) { |
| 462 |
goto skip_optional; |
| 463 |
} |
| 464 |
if (PyBytes_Check(args[13]) && PyBytes_GET_SIZE(args[13]) == 1) { |
| 465 |
n = PyBytes_AS_STRING(args[13])[0]; |
| 466 |
} |
| 467 |
else if (PyByteArray_Check(args[13]) && PyByteArray_GET_SIZE(args[13]) == 1) { |
| 468 |
n = PyByteArray_AS_STRING(args[13])[0]; |
| 469 |
} |
| 470 |
else { |
| 471 |
_PyArg_BadArgument("char_converter", "argument 14", "a byte string of length 1", args[13]); |
| 472 |
goto exit; |
| 473 |
} |
| 474 |
skip_optional: |
| 475 |
return_value = char_converter_impl(module, a, b, c, d, e, f, g, h, i, j, k, l, m, n); |
| 476 |
|
| 477 |
exit: |
| 478 |
return return_value; |
| 479 |
} |
| 480 |
|
| 481 |
PyDoc_STRVAR(unsigned_char_converter__doc__, |
| 482 |
"unsigned_char_converter($module, a=12, b=34, c=56, /)\n" |
| 483 |
"--\n" |
| 484 |
"\n"); |
| 485 |
|
| 486 |
#define UNSIGNED_CHAR_CONVERTER_METHODDEF \ |
| 487 |
{"unsigned_char_converter", _PyCFunction_CAST(unsigned_char_converter), METH_FASTCALL, unsigned_char_converter__doc__}, |
| 488 |
|
| 489 |
static PyObject * |
| 490 |
unsigned_char_converter_impl(PyObject *module, unsigned char a, |
| 491 |
unsigned char b, unsigned char c); |
| 492 |
|
| 493 |
static PyObject * |
| 494 |
unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 495 |
{ |
| 496 |
PyObject *return_value = NULL; |
| 497 |
unsigned char a = 12; |
| 498 |
unsigned char b = 34; |
| 499 |
unsigned char c = 56; |
| 500 |
|
| 501 |
if (!_PyArg_CheckPositional("unsigned_char_converter", nargs, 0, 3)) { |
| 502 |
goto exit; |
| 503 |
} |
| 504 |
if (nargs < 1) { |
| 505 |
goto skip_optional; |
| 506 |
} |
| 507 |
{ |
| 508 |
long ival = PyLong_AsLong(args[0]); |
| 509 |
if (ival == -1 && PyErr_Occurred()) { |
| 510 |
goto exit; |
| 511 |
} |
| 512 |
else if (ival < 0) { |
| 513 |
PyErr_SetString(PyExc_OverflowError, |
| 514 |
"unsigned byte integer is less than minimum"); |
| 515 |
goto exit; |
| 516 |
} |
| 517 |
else if (ival > UCHAR_MAX) { |
| 518 |
PyErr_SetString(PyExc_OverflowError, |
| 519 |
"unsigned byte integer is greater than maximum"); |
| 520 |
goto exit; |
| 521 |
} |
| 522 |
else { |
| 523 |
a = (unsigned char) ival; |
| 524 |
} |
| 525 |
} |
| 526 |
if (nargs < 2) { |
| 527 |
goto skip_optional; |
| 528 |
} |
| 529 |
{ |
| 530 |
long ival = PyLong_AsLong(args[1]); |
| 531 |
if (ival == -1 && PyErr_Occurred()) { |
| 532 |
goto exit; |
| 533 |
} |
| 534 |
else if (ival < 0) { |
| 535 |
PyErr_SetString(PyExc_OverflowError, |
| 536 |
"unsigned byte integer is less than minimum"); |
| 537 |
goto exit; |
| 538 |
} |
| 539 |
else if (ival > UCHAR_MAX) { |
| 540 |
PyErr_SetString(PyExc_OverflowError, |
| 541 |
"unsigned byte integer is greater than maximum"); |
| 542 |
goto exit; |
| 543 |
} |
| 544 |
else { |
| 545 |
b = (unsigned char) ival; |
| 546 |
} |
| 547 |
} |
| 548 |
if (nargs < 3) { |
| 549 |
goto skip_optional; |
| 550 |
} |
| 551 |
{ |
| 552 |
unsigned long ival = PyLong_AsUnsignedLongMask(args[2]); |
| 553 |
if (ival == (unsigned long)-1 && PyErr_Occurred()) { |
| 554 |
goto exit; |
| 555 |
} |
| 556 |
else { |
| 557 |
c = (unsigned char) ival; |
| 558 |
} |
| 559 |
} |
| 560 |
skip_optional: |
| 561 |
return_value = unsigned_char_converter_impl(module, a, b, c); |
| 562 |
|
| 563 |
exit: |
| 564 |
return return_value; |
| 565 |
} |
| 566 |
|
| 567 |
PyDoc_STRVAR(short_converter__doc__, |
| 568 |
"short_converter($module, a=12, /)\n" |
| 569 |
"--\n" |
| 570 |
"\n"); |
| 571 |
|
| 572 |
#define SHORT_CONVERTER_METHODDEF \ |
| 573 |
{"short_converter", _PyCFunction_CAST(short_converter), METH_FASTCALL, short_converter__doc__}, |
| 574 |
|
| 575 |
static PyObject * |
| 576 |
short_converter_impl(PyObject *module, short a); |
| 577 |
|
| 578 |
static PyObject * |
| 579 |
short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 580 |
{ |
| 581 |
PyObject *return_value = NULL; |
| 582 |
short a = 12; |
| 583 |
|
| 584 |
if (!_PyArg_CheckPositional("short_converter", nargs, 0, 1)) { |
| 585 |
goto exit; |
| 586 |
} |
| 587 |
if (nargs < 1) { |
| 588 |
goto skip_optional; |
| 589 |
} |
| 590 |
{ |
| 591 |
long ival = PyLong_AsLong(args[0]); |
| 592 |
if (ival == -1 && PyErr_Occurred()) { |
| 593 |
goto exit; |
| 594 |
} |
| 595 |
else if (ival < SHRT_MIN) { |
| 596 |
PyErr_SetString(PyExc_OverflowError, |
| 597 |
"signed short integer is less than minimum"); |
| 598 |
goto exit; |
| 599 |
} |
| 600 |
else if (ival > SHRT_MAX) { |
| 601 |
PyErr_SetString(PyExc_OverflowError, |
| 602 |
"signed short integer is greater than maximum"); |
| 603 |
goto exit; |
| 604 |
} |
| 605 |
else { |
| 606 |
a = (short) ival; |
| 607 |
} |
| 608 |
} |
| 609 |
skip_optional: |
| 610 |
return_value = short_converter_impl(module, a); |
| 611 |
|
| 612 |
exit: |
| 613 |
return return_value; |
| 614 |
} |
| 615 |
|
| 616 |
PyDoc_STRVAR(unsigned_short_converter__doc__, |
| 617 |
"unsigned_short_converter($module, a=12, b=34, c=56, /)\n" |
| 618 |
"--\n" |
| 619 |
"\n"); |
| 620 |
|
| 621 |
#define UNSIGNED_SHORT_CONVERTER_METHODDEF \ |
| 622 |
{"unsigned_short_converter", _PyCFunction_CAST(unsigned_short_converter), METH_FASTCALL, unsigned_short_converter__doc__}, |
| 623 |
|
| 624 |
static PyObject * |
| 625 |
unsigned_short_converter_impl(PyObject *module, unsigned short a, |
| 626 |
unsigned short b, unsigned short c); |
| 627 |
|
| 628 |
static PyObject * |
| 629 |
unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 630 |
{ |
| 631 |
PyObject *return_value = NULL; |
| 632 |
unsigned short a = 12; |
| 633 |
unsigned short b = 34; |
| 634 |
unsigned short c = 56; |
| 635 |
|
| 636 |
if (!_PyArg_CheckPositional("unsigned_short_converter", nargs, 0, 3)) { |
| 637 |
goto exit; |
| 638 |
} |
| 639 |
if (nargs < 1) { |
| 640 |
goto skip_optional; |
| 641 |
} |
| 642 |
if (!_PyLong_UnsignedShort_Converter(args[0], &a)) { |
| 643 |
goto exit; |
| 644 |
} |
| 645 |
if (nargs < 2) { |
| 646 |
goto skip_optional; |
| 647 |
} |
| 648 |
if (!_PyLong_UnsignedShort_Converter(args[1], &b)) { |
| 649 |
goto exit; |
| 650 |
} |
| 651 |
if (nargs < 3) { |
| 652 |
goto skip_optional; |
| 653 |
} |
| 654 |
c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]); |
| 655 |
if (c == (unsigned short)-1 && PyErr_Occurred()) { |
| 656 |
goto exit; |
| 657 |
} |
| 658 |
skip_optional: |
| 659 |
return_value = unsigned_short_converter_impl(module, a, b, c); |
| 660 |
|
| 661 |
exit: |
| 662 |
return return_value; |
| 663 |
} |
| 664 |
|
| 665 |
PyDoc_STRVAR(int_converter__doc__, |
| 666 |
"int_converter($module, a=12, b=34, c=45, /)\n" |
| 667 |
"--\n" |
| 668 |
"\n"); |
| 669 |
|
| 670 |
#define INT_CONVERTER_METHODDEF \ |
| 671 |
{"int_converter", _PyCFunction_CAST(int_converter), METH_FASTCALL, int_converter__doc__}, |
| 672 |
|
| 673 |
static PyObject * |
| 674 |
int_converter_impl(PyObject *module, int a, int b, int c); |
| 675 |
|
| 676 |
static PyObject * |
| 677 |
int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 678 |
{ |
| 679 |
PyObject *return_value = NULL; |
| 680 |
int a = 12; |
| 681 |
int b = 34; |
| 682 |
int c = 45; |
| 683 |
|
| 684 |
if (!_PyArg_CheckPositional("int_converter", nargs, 0, 3)) { |
| 685 |
goto exit; |
| 686 |
} |
| 687 |
if (nargs < 1) { |
| 688 |
goto skip_optional; |
| 689 |
} |
| 690 |
a = PyLong_AsInt(args[0]); |
| 691 |
if (a == -1 && PyErr_Occurred()) { |
| 692 |
goto exit; |
| 693 |
} |
| 694 |
if (nargs < 2) { |
| 695 |
goto skip_optional; |
| 696 |
} |
| 697 |
b = PyLong_AsInt(args[1]); |
| 698 |
if (b == -1 && PyErr_Occurred()) { |
| 699 |
goto exit; |
| 700 |
} |
| 701 |
if (nargs < 3) { |
| 702 |
goto skip_optional; |
| 703 |
} |
| 704 |
if (!PyUnicode_Check(args[2])) { |
| 705 |
_PyArg_BadArgument("int_converter", "argument 3", "a unicode character", args[2]); |
| 706 |
goto exit; |
| 707 |
} |
| 708 |
if (PyUnicode_GET_LENGTH(args[2]) != 1) { |
| 709 |
_PyArg_BadArgument("int_converter", "argument 3", "a unicode character", args[2]); |
| 710 |
goto exit; |
| 711 |
} |
| 712 |
c = PyUnicode_READ_CHAR(args[2], 0); |
| 713 |
skip_optional: |
| 714 |
return_value = int_converter_impl(module, a, b, c); |
| 715 |
|
| 716 |
exit: |
| 717 |
return return_value; |
| 718 |
} |
| 719 |
|
| 720 |
PyDoc_STRVAR(unsigned_int_converter__doc__, |
| 721 |
"unsigned_int_converter($module, a=12, b=34, c=56, /)\n" |
| 722 |
"--\n" |
| 723 |
"\n"); |
| 724 |
|
| 725 |
#define UNSIGNED_INT_CONVERTER_METHODDEF \ |
| 726 |
{"unsigned_int_converter", _PyCFunction_CAST(unsigned_int_converter), METH_FASTCALL, unsigned_int_converter__doc__}, |
| 727 |
|
| 728 |
static PyObject * |
| 729 |
unsigned_int_converter_impl(PyObject *module, unsigned int a, unsigned int b, |
| 730 |
unsigned int c); |
| 731 |
|
| 732 |
static PyObject * |
| 733 |
unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 734 |
{ |
| 735 |
PyObject *return_value = NULL; |
| 736 |
unsigned int a = 12; |
| 737 |
unsigned int b = 34; |
| 738 |
unsigned int c = 56; |
| 739 |
|
| 740 |
if (!_PyArg_CheckPositional("unsigned_int_converter", nargs, 0, 3)) { |
| 741 |
goto exit; |
| 742 |
} |
| 743 |
if (nargs < 1) { |
| 744 |
goto skip_optional; |
| 745 |
} |
| 746 |
if (!_PyLong_UnsignedInt_Converter(args[0], &a)) { |
| 747 |
goto exit; |
| 748 |
} |
| 749 |
if (nargs < 2) { |
| 750 |
goto skip_optional; |
| 751 |
} |
| 752 |
if (!_PyLong_UnsignedInt_Converter(args[1], &b)) { |
| 753 |
goto exit; |
| 754 |
} |
| 755 |
if (nargs < 3) { |
| 756 |
goto skip_optional; |
| 757 |
} |
| 758 |
c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]); |
| 759 |
if (c == (unsigned int)-1 && PyErr_Occurred()) { |
| 760 |
goto exit; |
| 761 |
} |
| 762 |
skip_optional: |
| 763 |
return_value = unsigned_int_converter_impl(module, a, b, c); |
| 764 |
|
| 765 |
exit: |
| 766 |
return return_value; |
| 767 |
} |
| 768 |
|
| 769 |
PyDoc_STRVAR(long_converter__doc__, |
| 770 |
"long_converter($module, a=12, /)\n" |
| 771 |
"--\n" |
| 772 |
"\n"); |
| 773 |
|
| 774 |
#define LONG_CONVERTER_METHODDEF \ |
| 775 |
{"long_converter", _PyCFunction_CAST(long_converter), METH_FASTCALL, long_converter__doc__}, |
| 776 |
|
| 777 |
static PyObject * |
| 778 |
long_converter_impl(PyObject *module, long a); |
| 779 |
|
| 780 |
static PyObject * |
| 781 |
long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 782 |
{ |
| 783 |
PyObject *return_value = NULL; |
| 784 |
long a = 12; |
| 785 |
|
| 786 |
if (!_PyArg_CheckPositional("long_converter", nargs, 0, 1)) { |
| 787 |
goto exit; |
| 788 |
} |
| 789 |
if (nargs < 1) { |
| 790 |
goto skip_optional; |
| 791 |
} |
| 792 |
a = PyLong_AsLong(args[0]); |
| 793 |
if (a == -1 && PyErr_Occurred()) { |
| 794 |
goto exit; |
| 795 |
} |
| 796 |
skip_optional: |
| 797 |
return_value = long_converter_impl(module, a); |
| 798 |
|
| 799 |
exit: |
| 800 |
return return_value; |
| 801 |
} |
| 802 |
|
| 803 |
PyDoc_STRVAR(unsigned_long_converter__doc__, |
| 804 |
"unsigned_long_converter($module, a=12, b=34, c=56, /)\n" |
| 805 |
"--\n" |
| 806 |
"\n"); |
| 807 |
|
| 808 |
#define UNSIGNED_LONG_CONVERTER_METHODDEF \ |
| 809 |
{"unsigned_long_converter", _PyCFunction_CAST(unsigned_long_converter), METH_FASTCALL, unsigned_long_converter__doc__}, |
| 810 |
|
| 811 |
static PyObject * |
| 812 |
unsigned_long_converter_impl(PyObject *module, unsigned long a, |
| 813 |
unsigned long b, unsigned long c); |
| 814 |
|
| 815 |
static PyObject * |
| 816 |
unsigned_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 817 |
{ |
| 818 |
PyObject *return_value = NULL; |
| 819 |
unsigned long a = 12; |
| 820 |
unsigned long b = 34; |
| 821 |
unsigned long c = 56; |
| 822 |
|
| 823 |
if (!_PyArg_CheckPositional("unsigned_long_converter", nargs, 0, 3)) { |
| 824 |
goto exit; |
| 825 |
} |
| 826 |
if (nargs < 1) { |
| 827 |
goto skip_optional; |
| 828 |
} |
| 829 |
if (!_PyLong_UnsignedLong_Converter(args[0], &a)) { |
| 830 |
goto exit; |
| 831 |
} |
| 832 |
if (nargs < 2) { |
| 833 |
goto skip_optional; |
| 834 |
} |
| 835 |
if (!_PyLong_UnsignedLong_Converter(args[1], &b)) { |
| 836 |
goto exit; |
| 837 |
} |
| 838 |
if (nargs < 3) { |
| 839 |
goto skip_optional; |
| 840 |
} |
| 841 |
if (!PyLong_Check(args[2])) { |
| 842 |
_PyArg_BadArgument("unsigned_long_converter", "argument 3", "int", args[2]); |
| 843 |
goto exit; |
| 844 |
} |
| 845 |
c = PyLong_AsUnsignedLongMask(args[2]); |
| 846 |
skip_optional: |
| 847 |
return_value = unsigned_long_converter_impl(module, a, b, c); |
| 848 |
|
| 849 |
exit: |
| 850 |
return return_value; |
| 851 |
} |
| 852 |
|
| 853 |
PyDoc_STRVAR(long_long_converter__doc__, |
| 854 |
"long_long_converter($module, a=12, /)\n" |
| 855 |
"--\n" |
| 856 |
"\n"); |
| 857 |
|
| 858 |
#define LONG_LONG_CONVERTER_METHODDEF \ |
| 859 |
{"long_long_converter", _PyCFunction_CAST(long_long_converter), METH_FASTCALL, long_long_converter__doc__}, |
| 860 |
|
| 861 |
static PyObject * |
| 862 |
long_long_converter_impl(PyObject *module, long long a); |
| 863 |
|
| 864 |
static PyObject * |
| 865 |
long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 866 |
{ |
| 867 |
PyObject *return_value = NULL; |
| 868 |
long long a = 12; |
| 869 |
|
| 870 |
if (!_PyArg_CheckPositional("long_long_converter", nargs, 0, 1)) { |
| 871 |
goto exit; |
| 872 |
} |
| 873 |
if (nargs < 1) { |
| 874 |
goto skip_optional; |
| 875 |
} |
| 876 |
a = PyLong_AsLongLong(args[0]); |
| 877 |
if (a == -1 && PyErr_Occurred()) { |
| 878 |
goto exit; |
| 879 |
} |
| 880 |
skip_optional: |
| 881 |
return_value = long_long_converter_impl(module, a); |
| 882 |
|
| 883 |
exit: |
| 884 |
return return_value; |
| 885 |
} |
| 886 |
|
| 887 |
PyDoc_STRVAR(unsigned_long_long_converter__doc__, |
| 888 |
"unsigned_long_long_converter($module, a=12, b=34, c=56, /)\n" |
| 889 |
"--\n" |
| 890 |
"\n"); |
| 891 |
|
| 892 |
#define UNSIGNED_LONG_LONG_CONVERTER_METHODDEF \ |
| 893 |
{"unsigned_long_long_converter", _PyCFunction_CAST(unsigned_long_long_converter), METH_FASTCALL, unsigned_long_long_converter__doc__}, |
| 894 |
|
| 895 |
static PyObject * |
| 896 |
unsigned_long_long_converter_impl(PyObject *module, unsigned long long a, |
| 897 |
unsigned long long b, unsigned long long c); |
| 898 |
|
| 899 |
static PyObject * |
| 900 |
unsigned_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 901 |
{ |
| 902 |
PyObject *return_value = NULL; |
| 903 |
unsigned long long a = 12; |
| 904 |
unsigned long long b = 34; |
| 905 |
unsigned long long c = 56; |
| 906 |
|
| 907 |
if (!_PyArg_CheckPositional("unsigned_long_long_converter", nargs, 0, 3)) { |
| 908 |
goto exit; |
| 909 |
} |
| 910 |
if (nargs < 1) { |
| 911 |
goto skip_optional; |
| 912 |
} |
| 913 |
if (!_PyLong_UnsignedLongLong_Converter(args[0], &a)) { |
| 914 |
goto exit; |
| 915 |
} |
| 916 |
if (nargs < 2) { |
| 917 |
goto skip_optional; |
| 918 |
} |
| 919 |
if (!_PyLong_UnsignedLongLong_Converter(args[1], &b)) { |
| 920 |
goto exit; |
| 921 |
} |
| 922 |
if (nargs < 3) { |
| 923 |
goto skip_optional; |
| 924 |
} |
| 925 |
if (!PyLong_Check(args[2])) { |
| 926 |
_PyArg_BadArgument("unsigned_long_long_converter", "argument 3", "int", args[2]); |
| 927 |
goto exit; |
| 928 |
} |
| 929 |
c = PyLong_AsUnsignedLongLongMask(args[2]); |
| 930 |
skip_optional: |
| 931 |
return_value = unsigned_long_long_converter_impl(module, a, b, c); |
| 932 |
|
| 933 |
exit: |
| 934 |
return return_value; |
| 935 |
} |
| 936 |
|
| 937 |
PyDoc_STRVAR(py_ssize_t_converter__doc__, |
| 938 |
"py_ssize_t_converter($module, a=12, b=34, c=56, /)\n" |
| 939 |
"--\n" |
| 940 |
"\n"); |
| 941 |
|
| 942 |
#define PY_SSIZE_T_CONVERTER_METHODDEF \ |
| 943 |
{"py_ssize_t_converter", _PyCFunction_CAST(py_ssize_t_converter), METH_FASTCALL, py_ssize_t_converter__doc__}, |
| 944 |
|
| 945 |
static PyObject * |
| 946 |
py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b, |
| 947 |
Py_ssize_t c); |
| 948 |
|
| 949 |
static PyObject * |
| 950 |
py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 951 |
{ |
| 952 |
PyObject *return_value = NULL; |
| 953 |
Py_ssize_t a = 12; |
| 954 |
Py_ssize_t b = 34; |
| 955 |
Py_ssize_t c = 56; |
| 956 |
|
| 957 |
if (!_PyArg_CheckPositional("py_ssize_t_converter", nargs, 0, 3)) { |
| 958 |
goto exit; |
| 959 |
} |
| 960 |
if (nargs < 1) { |
| 961 |
goto skip_optional; |
| 962 |
} |
| 963 |
{ |
| 964 |
Py_ssize_t ival = -1; |
| 965 |
PyObject *iobj = _PyNumber_Index(args[0]); |
| 966 |
if (iobj != NULL) { |
| 967 |
ival = PyLong_AsSsize_t(iobj); |
| 968 |
Py_DECREF(iobj); |
| 969 |
} |
| 970 |
if (ival == -1 && PyErr_Occurred()) { |
| 971 |
goto exit; |
| 972 |
} |
| 973 |
a = ival; |
| 974 |
} |
| 975 |
if (nargs < 2) { |
| 976 |
goto skip_optional; |
| 977 |
} |
| 978 |
{ |
| 979 |
Py_ssize_t ival = -1; |
| 980 |
PyObject *iobj = _PyNumber_Index(args[1]); |
| 981 |
if (iobj != NULL) { |
| 982 |
ival = PyLong_AsSsize_t(iobj); |
| 983 |
Py_DECREF(iobj); |
| 984 |
} |
| 985 |
if (ival == -1 && PyErr_Occurred()) { |
| 986 |
goto exit; |
| 987 |
} |
| 988 |
b = ival; |
| 989 |
} |
| 990 |
if (nargs < 3) { |
| 991 |
goto skip_optional; |
| 992 |
} |
| 993 |
if (!_Py_convert_optional_to_ssize_t(args[2], &c)) { |
| 994 |
goto exit; |
| 995 |
} |
| 996 |
skip_optional: |
| 997 |
return_value = py_ssize_t_converter_impl(module, a, b, c); |
| 998 |
|
| 999 |
exit: |
| 1000 |
return return_value; |
| 1001 |
} |
| 1002 |
|
| 1003 |
PyDoc_STRVAR(slice_index_converter__doc__, |
| 1004 |
"slice_index_converter($module, a=12, b=34, c=56, /)\n" |
| 1005 |
"--\n" |
| 1006 |
"\n"); |
| 1007 |
|
| 1008 |
#define SLICE_INDEX_CONVERTER_METHODDEF \ |
| 1009 |
{"slice_index_converter", _PyCFunction_CAST(slice_index_converter), METH_FASTCALL, slice_index_converter__doc__}, |
| 1010 |
|
| 1011 |
static PyObject * |
| 1012 |
slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b, |
| 1013 |
Py_ssize_t c); |
| 1014 |
|
| 1015 |
static PyObject * |
| 1016 |
slice_index_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1017 |
{ |
| 1018 |
PyObject *return_value = NULL; |
| 1019 |
Py_ssize_t a = 12; |
| 1020 |
Py_ssize_t b = 34; |
| 1021 |
Py_ssize_t c = 56; |
| 1022 |
|
| 1023 |
if (!_PyArg_CheckPositional("slice_index_converter", nargs, 0, 3)) { |
| 1024 |
goto exit; |
| 1025 |
} |
| 1026 |
if (nargs < 1) { |
| 1027 |
goto skip_optional; |
| 1028 |
} |
| 1029 |
if (!_PyEval_SliceIndex(args[0], &a)) { |
| 1030 |
goto exit; |
| 1031 |
} |
| 1032 |
if (nargs < 2) { |
| 1033 |
goto skip_optional; |
| 1034 |
} |
| 1035 |
if (!_PyEval_SliceIndexNotNone(args[1], &b)) { |
| 1036 |
goto exit; |
| 1037 |
} |
| 1038 |
if (nargs < 3) { |
| 1039 |
goto skip_optional; |
| 1040 |
} |
| 1041 |
if (!_PyEval_SliceIndex(args[2], &c)) { |
| 1042 |
goto exit; |
| 1043 |
} |
| 1044 |
skip_optional: |
| 1045 |
return_value = slice_index_converter_impl(module, a, b, c); |
| 1046 |
|
| 1047 |
exit: |
| 1048 |
return return_value; |
| 1049 |
} |
| 1050 |
|
| 1051 |
PyDoc_STRVAR(size_t_converter__doc__, |
| 1052 |
"size_t_converter($module, a=12, /)\n" |
| 1053 |
"--\n" |
| 1054 |
"\n"); |
| 1055 |
|
| 1056 |
#define SIZE_T_CONVERTER_METHODDEF \ |
| 1057 |
{"size_t_converter", _PyCFunction_CAST(size_t_converter), METH_FASTCALL, size_t_converter__doc__}, |
| 1058 |
|
| 1059 |
static PyObject * |
| 1060 |
size_t_converter_impl(PyObject *module, size_t a); |
| 1061 |
|
| 1062 |
static PyObject * |
| 1063 |
size_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1064 |
{ |
| 1065 |
PyObject *return_value = NULL; |
| 1066 |
size_t a = 12; |
| 1067 |
|
| 1068 |
if (!_PyArg_CheckPositional("size_t_converter", nargs, 0, 1)) { |
| 1069 |
goto exit; |
| 1070 |
} |
| 1071 |
if (nargs < 1) { |
| 1072 |
goto skip_optional; |
| 1073 |
} |
| 1074 |
if (!_PyLong_Size_t_Converter(args[0], &a)) { |
| 1075 |
goto exit; |
| 1076 |
} |
| 1077 |
skip_optional: |
| 1078 |
return_value = size_t_converter_impl(module, a); |
| 1079 |
|
| 1080 |
exit: |
| 1081 |
return return_value; |
| 1082 |
} |
| 1083 |
|
| 1084 |
PyDoc_STRVAR(float_converter__doc__, |
| 1085 |
"float_converter($module, a=12.5, /)\n" |
| 1086 |
"--\n" |
| 1087 |
"\n"); |
| 1088 |
|
| 1089 |
#define FLOAT_CONVERTER_METHODDEF \ |
| 1090 |
{"float_converter", _PyCFunction_CAST(float_converter), METH_FASTCALL, float_converter__doc__}, |
| 1091 |
|
| 1092 |
static PyObject * |
| 1093 |
float_converter_impl(PyObject *module, float a); |
| 1094 |
|
| 1095 |
static PyObject * |
| 1096 |
float_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1097 |
{ |
| 1098 |
PyObject *return_value = NULL; |
| 1099 |
float a = 12.5; |
| 1100 |
|
| 1101 |
if (!_PyArg_CheckPositional("float_converter", nargs, 0, 1)) { |
| 1102 |
goto exit; |
| 1103 |
} |
| 1104 |
if (nargs < 1) { |
| 1105 |
goto skip_optional; |
| 1106 |
} |
| 1107 |
if (PyFloat_CheckExact(args[0])) { |
| 1108 |
a = (float) (PyFloat_AS_DOUBLE(args[0])); |
| 1109 |
} |
| 1110 |
else |
| 1111 |
{ |
| 1112 |
a = (float) PyFloat_AsDouble(args[0]); |
| 1113 |
if (a == -1.0 && PyErr_Occurred()) { |
| 1114 |
goto exit; |
| 1115 |
} |
| 1116 |
} |
| 1117 |
skip_optional: |
| 1118 |
return_value = float_converter_impl(module, a); |
| 1119 |
|
| 1120 |
exit: |
| 1121 |
return return_value; |
| 1122 |
} |
| 1123 |
|
| 1124 |
PyDoc_STRVAR(double_converter__doc__, |
| 1125 |
"double_converter($module, a=12.5, /)\n" |
| 1126 |
"--\n" |
| 1127 |
"\n"); |
| 1128 |
|
| 1129 |
#define DOUBLE_CONVERTER_METHODDEF \ |
| 1130 |
{"double_converter", _PyCFunction_CAST(double_converter), METH_FASTCALL, double_converter__doc__}, |
| 1131 |
|
| 1132 |
static PyObject * |
| 1133 |
double_converter_impl(PyObject *module, double a); |
| 1134 |
|
| 1135 |
static PyObject * |
| 1136 |
double_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1137 |
{ |
| 1138 |
PyObject *return_value = NULL; |
| 1139 |
double a = 12.5; |
| 1140 |
|
| 1141 |
if (!_PyArg_CheckPositional("double_converter", nargs, 0, 1)) { |
| 1142 |
goto exit; |
| 1143 |
} |
| 1144 |
if (nargs < 1) { |
| 1145 |
goto skip_optional; |
| 1146 |
} |
| 1147 |
if (PyFloat_CheckExact(args[0])) { |
| 1148 |
a = PyFloat_AS_DOUBLE(args[0]); |
| 1149 |
} |
| 1150 |
else |
| 1151 |
{ |
| 1152 |
a = PyFloat_AsDouble(args[0]); |
| 1153 |
if (a == -1.0 && PyErr_Occurred()) { |
| 1154 |
goto exit; |
| 1155 |
} |
| 1156 |
} |
| 1157 |
skip_optional: |
| 1158 |
return_value = double_converter_impl(module, a); |
| 1159 |
|
| 1160 |
exit: |
| 1161 |
return return_value; |
| 1162 |
} |
| 1163 |
|
| 1164 |
PyDoc_STRVAR(py_complex_converter__doc__, |
| 1165 |
"py_complex_converter($module, a, /)\n" |
| 1166 |
"--\n" |
| 1167 |
"\n"); |
| 1168 |
|
| 1169 |
#define PY_COMPLEX_CONVERTER_METHODDEF \ |
| 1170 |
{"py_complex_converter", (PyCFunction)py_complex_converter, METH_O, py_complex_converter__doc__}, |
| 1171 |
|
| 1172 |
static PyObject * |
| 1173 |
py_complex_converter_impl(PyObject *module, Py_complex a); |
| 1174 |
|
| 1175 |
static PyObject * |
| 1176 |
py_complex_converter(PyObject *module, PyObject *arg) |
| 1177 |
{ |
| 1178 |
PyObject *return_value = NULL; |
| 1179 |
Py_complex a; |
| 1180 |
|
| 1181 |
a = PyComplex_AsCComplex(arg); |
| 1182 |
if (PyErr_Occurred()) { |
| 1183 |
goto exit; |
| 1184 |
} |
| 1185 |
return_value = py_complex_converter_impl(module, a); |
| 1186 |
|
| 1187 |
exit: |
| 1188 |
return return_value; |
| 1189 |
} |
| 1190 |
|
| 1191 |
PyDoc_STRVAR(str_converter__doc__, |
| 1192 |
"str_converter($module, a=\'a\', b=\'b\', c=\'c\', /)\n" |
| 1193 |
"--\n" |
| 1194 |
"\n"); |
| 1195 |
|
| 1196 |
#define STR_CONVERTER_METHODDEF \ |
| 1197 |
{"str_converter", _PyCFunction_CAST(str_converter), METH_FASTCALL, str_converter__doc__}, |
| 1198 |
|
| 1199 |
static PyObject * |
| 1200 |
str_converter_impl(PyObject *module, const char *a, const char *b, |
| 1201 |
const char *c, Py_ssize_t c_length); |
| 1202 |
|
| 1203 |
static PyObject * |
| 1204 |
str_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1205 |
{ |
| 1206 |
PyObject *return_value = NULL; |
| 1207 |
const char *a = "a"; |
| 1208 |
const char *b = "b"; |
| 1209 |
const char *c = "c"; |
| 1210 |
Py_ssize_t c_length; |
| 1211 |
|
| 1212 |
if (!_PyArg_ParseStack(args, nargs, "|sys#:str_converter", |
| 1213 |
&a, &b, &c, &c_length)) { |
| 1214 |
goto exit; |
| 1215 |
} |
| 1216 |
return_value = str_converter_impl(module, a, b, c, c_length); |
| 1217 |
|
| 1218 |
exit: |
| 1219 |
return return_value; |
| 1220 |
} |
| 1221 |
|
| 1222 |
PyDoc_STRVAR(str_converter_encoding__doc__, |
| 1223 |
"str_converter_encoding($module, a, b, c, /)\n" |
| 1224 |
"--\n" |
| 1225 |
"\n"); |
| 1226 |
|
| 1227 |
#define STR_CONVERTER_ENCODING_METHODDEF \ |
| 1228 |
{"str_converter_encoding", _PyCFunction_CAST(str_converter_encoding), METH_FASTCALL, str_converter_encoding__doc__}, |
| 1229 |
|
| 1230 |
static PyObject * |
| 1231 |
str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c, |
| 1232 |
Py_ssize_t c_length); |
| 1233 |
|
| 1234 |
static PyObject * |
| 1235 |
str_converter_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1236 |
{ |
| 1237 |
PyObject *return_value = NULL; |
| 1238 |
char *a = NULL; |
| 1239 |
char *b = NULL; |
| 1240 |
char *c = NULL; |
| 1241 |
Py_ssize_t c_length; |
| 1242 |
|
| 1243 |
if (!_PyArg_ParseStack(args, nargs, "esetet#:str_converter_encoding", |
| 1244 |
"idna", &a, "idna", &b, "idna", &c, &c_length)) { |
| 1245 |
goto exit; |
| 1246 |
} |
| 1247 |
return_value = str_converter_encoding_impl(module, a, b, c, c_length); |
| 1248 |
/* Post parse cleanup for a */ |
| 1249 |
PyMem_FREE(a); |
| 1250 |
/* Post parse cleanup for b */ |
| 1251 |
PyMem_FREE(b); |
| 1252 |
/* Post parse cleanup for c */ |
| 1253 |
PyMem_FREE(c); |
| 1254 |
|
| 1255 |
exit: |
| 1256 |
return return_value; |
| 1257 |
} |
| 1258 |
|
| 1259 |
PyDoc_STRVAR(py_buffer_converter__doc__, |
| 1260 |
"py_buffer_converter($module, a, b, /)\n" |
| 1261 |
"--\n" |
| 1262 |
"\n"); |
| 1263 |
|
| 1264 |
#define PY_BUFFER_CONVERTER_METHODDEF \ |
| 1265 |
{"py_buffer_converter", _PyCFunction_CAST(py_buffer_converter), METH_FASTCALL, py_buffer_converter__doc__}, |
| 1266 |
|
| 1267 |
static PyObject * |
| 1268 |
py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b); |
| 1269 |
|
| 1270 |
static PyObject * |
| 1271 |
py_buffer_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 1272 |
{ |
| 1273 |
PyObject *return_value = NULL; |
| 1274 |
Py_buffer a = {NULL, NULL}; |
| 1275 |
Py_buffer b = {NULL, NULL}; |
| 1276 |
|
| 1277 |
if (!_PyArg_ParseStack(args, nargs, "z*w*:py_buffer_converter", |
| 1278 |
&a, &b)) { |
| 1279 |
goto exit; |
| 1280 |
} |
| 1281 |
return_value = py_buffer_converter_impl(module, &a, &b); |
| 1282 |
|
| 1283 |
exit: |
| 1284 |
/* Cleanup for a */ |
| 1285 |
if (a.obj) { |
| 1286 |
PyBuffer_Release(&a); |
| 1287 |
} |
| 1288 |
/* Cleanup for b */ |
| 1289 |
if (b.obj) { |
| 1290 |
PyBuffer_Release(&b); |
| 1291 |
} |
| 1292 |
|
| 1293 |
return return_value; |
| 1294 |
} |
| 1295 |
|
| 1296 |
PyDoc_STRVAR(keywords__doc__, |
| 1297 |
"keywords($module, /, a, b)\n" |
| 1298 |
"--\n" |
| 1299 |
"\n"); |
| 1300 |
|
| 1301 |
#define KEYWORDS_METHODDEF \ |
| 1302 |
{"keywords", _PyCFunction_CAST(keywords), METH_FASTCALL|METH_KEYWORDS, keywords__doc__}, |
| 1303 |
|
| 1304 |
static PyObject * |
| 1305 |
keywords_impl(PyObject *module, PyObject *a, PyObject *b); |
| 1306 |
|
| 1307 |
static PyObject * |
| 1308 |
keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1309 |
{ |
| 1310 |
PyObject *return_value = NULL; |
| 1311 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1312 |
|
| 1313 |
#define NUM_KEYWORDS 2 |
| 1314 |
static struct { |
| 1315 |
PyGC_Head _this_is_not_used; |
| 1316 |
PyObject_VAR_HEAD |
| 1317 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1318 |
} _kwtuple = { |
| 1319 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1320 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), }, |
| 1321 |
}; |
| 1322 |
#undef NUM_KEYWORDS |
| 1323 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1324 |
|
| 1325 |
#else // !Py_BUILD_CORE |
| 1326 |
# define KWTUPLE NULL |
| 1327 |
#endif // !Py_BUILD_CORE |
| 1328 |
|
| 1329 |
static const char * const _keywords[] = {"a", "b", NULL}; |
| 1330 |
static _PyArg_Parser _parser = { |
| 1331 |
.keywords = _keywords, |
| 1332 |
.fname = "keywords", |
| 1333 |
.kwtuple = KWTUPLE, |
| 1334 |
}; |
| 1335 |
#undef KWTUPLE |
| 1336 |
PyObject *argsbuf[2]; |
| 1337 |
PyObject *a; |
| 1338 |
PyObject *b; |
| 1339 |
|
| 1340 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); |
| 1341 |
if (!args) { |
| 1342 |
goto exit; |
| 1343 |
} |
| 1344 |
a = args[0]; |
| 1345 |
b = args[1]; |
| 1346 |
return_value = keywords_impl(module, a, b); |
| 1347 |
|
| 1348 |
exit: |
| 1349 |
return return_value; |
| 1350 |
} |
| 1351 |
|
| 1352 |
PyDoc_STRVAR(keywords_kwonly__doc__, |
| 1353 |
"keywords_kwonly($module, /, a, *, b)\n" |
| 1354 |
"--\n" |
| 1355 |
"\n"); |
| 1356 |
|
| 1357 |
#define KEYWORDS_KWONLY_METHODDEF \ |
| 1358 |
{"keywords_kwonly", _PyCFunction_CAST(keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, keywords_kwonly__doc__}, |
| 1359 |
|
| 1360 |
static PyObject * |
| 1361 |
keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b); |
| 1362 |
|
| 1363 |
static PyObject * |
| 1364 |
keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1365 |
{ |
| 1366 |
PyObject *return_value = NULL; |
| 1367 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1368 |
|
| 1369 |
#define NUM_KEYWORDS 2 |
| 1370 |
static struct { |
| 1371 |
PyGC_Head _this_is_not_used; |
| 1372 |
PyObject_VAR_HEAD |
| 1373 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1374 |
} _kwtuple = { |
| 1375 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1376 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), }, |
| 1377 |
}; |
| 1378 |
#undef NUM_KEYWORDS |
| 1379 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1380 |
|
| 1381 |
#else // !Py_BUILD_CORE |
| 1382 |
# define KWTUPLE NULL |
| 1383 |
#endif // !Py_BUILD_CORE |
| 1384 |
|
| 1385 |
static const char * const _keywords[] = {"a", "b", NULL}; |
| 1386 |
static _PyArg_Parser _parser = { |
| 1387 |
.keywords = _keywords, |
| 1388 |
.fname = "keywords_kwonly", |
| 1389 |
.kwtuple = KWTUPLE, |
| 1390 |
}; |
| 1391 |
#undef KWTUPLE |
| 1392 |
PyObject *argsbuf[2]; |
| 1393 |
PyObject *a; |
| 1394 |
PyObject *b; |
| 1395 |
|
| 1396 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf); |
| 1397 |
if (!args) { |
| 1398 |
goto exit; |
| 1399 |
} |
| 1400 |
a = args[0]; |
| 1401 |
b = args[1]; |
| 1402 |
return_value = keywords_kwonly_impl(module, a, b); |
| 1403 |
|
| 1404 |
exit: |
| 1405 |
return return_value; |
| 1406 |
} |
| 1407 |
|
| 1408 |
PyDoc_STRVAR(keywords_opt__doc__, |
| 1409 |
"keywords_opt($module, /, a, b=None, c=None)\n" |
| 1410 |
"--\n" |
| 1411 |
"\n"); |
| 1412 |
|
| 1413 |
#define KEYWORDS_OPT_METHODDEF \ |
| 1414 |
{"keywords_opt", _PyCFunction_CAST(keywords_opt), METH_FASTCALL|METH_KEYWORDS, keywords_opt__doc__}, |
| 1415 |
|
| 1416 |
static PyObject * |
| 1417 |
keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c); |
| 1418 |
|
| 1419 |
static PyObject * |
| 1420 |
keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1421 |
{ |
| 1422 |
PyObject *return_value = NULL; |
| 1423 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1424 |
|
| 1425 |
#define NUM_KEYWORDS 3 |
| 1426 |
static struct { |
| 1427 |
PyGC_Head _this_is_not_used; |
| 1428 |
PyObject_VAR_HEAD |
| 1429 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1430 |
} _kwtuple = { |
| 1431 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1432 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), }, |
| 1433 |
}; |
| 1434 |
#undef NUM_KEYWORDS |
| 1435 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1436 |
|
| 1437 |
#else // !Py_BUILD_CORE |
| 1438 |
# define KWTUPLE NULL |
| 1439 |
#endif // !Py_BUILD_CORE |
| 1440 |
|
| 1441 |
static const char * const _keywords[] = {"a", "b", "c", NULL}; |
| 1442 |
static _PyArg_Parser _parser = { |
| 1443 |
.keywords = _keywords, |
| 1444 |
.fname = "keywords_opt", |
| 1445 |
.kwtuple = KWTUPLE, |
| 1446 |
}; |
| 1447 |
#undef KWTUPLE |
| 1448 |
PyObject *argsbuf[3]; |
| 1449 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 1450 |
PyObject *a; |
| 1451 |
PyObject *b = Py_None; |
| 1452 |
PyObject *c = Py_None; |
| 1453 |
|
| 1454 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); |
| 1455 |
if (!args) { |
| 1456 |
goto exit; |
| 1457 |
} |
| 1458 |
a = args[0]; |
| 1459 |
if (!noptargs) { |
| 1460 |
goto skip_optional_pos; |
| 1461 |
} |
| 1462 |
if (args[1]) { |
| 1463 |
b = args[1]; |
| 1464 |
if (!--noptargs) { |
| 1465 |
goto skip_optional_pos; |
| 1466 |
} |
| 1467 |
} |
| 1468 |
c = args[2]; |
| 1469 |
skip_optional_pos: |
| 1470 |
return_value = keywords_opt_impl(module, a, b, c); |
| 1471 |
|
| 1472 |
exit: |
| 1473 |
return return_value; |
| 1474 |
} |
| 1475 |
|
| 1476 |
PyDoc_STRVAR(keywords_opt_kwonly__doc__, |
| 1477 |
"keywords_opt_kwonly($module, /, a, b=None, *, c=None, d=None)\n" |
| 1478 |
"--\n" |
| 1479 |
"\n"); |
| 1480 |
|
| 1481 |
#define KEYWORDS_OPT_KWONLY_METHODDEF \ |
| 1482 |
{"keywords_opt_kwonly", _PyCFunction_CAST(keywords_opt_kwonly), METH_FASTCALL|METH_KEYWORDS, keywords_opt_kwonly__doc__}, |
| 1483 |
|
| 1484 |
static PyObject * |
| 1485 |
keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1486 |
PyObject *c, PyObject *d); |
| 1487 |
|
| 1488 |
static PyObject * |
| 1489 |
keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1490 |
{ |
| 1491 |
PyObject *return_value = NULL; |
| 1492 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1493 |
|
| 1494 |
#define NUM_KEYWORDS 4 |
| 1495 |
static struct { |
| 1496 |
PyGC_Head _this_is_not_used; |
| 1497 |
PyObject_VAR_HEAD |
| 1498 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1499 |
} _kwtuple = { |
| 1500 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1501 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 1502 |
}; |
| 1503 |
#undef NUM_KEYWORDS |
| 1504 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1505 |
|
| 1506 |
#else // !Py_BUILD_CORE |
| 1507 |
# define KWTUPLE NULL |
| 1508 |
#endif // !Py_BUILD_CORE |
| 1509 |
|
| 1510 |
static const char * const _keywords[] = {"a", "b", "c", "d", NULL}; |
| 1511 |
static _PyArg_Parser _parser = { |
| 1512 |
.keywords = _keywords, |
| 1513 |
.fname = "keywords_opt_kwonly", |
| 1514 |
.kwtuple = KWTUPLE, |
| 1515 |
}; |
| 1516 |
#undef KWTUPLE |
| 1517 |
PyObject *argsbuf[4]; |
| 1518 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 1519 |
PyObject *a; |
| 1520 |
PyObject *b = Py_None; |
| 1521 |
PyObject *c = Py_None; |
| 1522 |
PyObject *d = Py_None; |
| 1523 |
|
| 1524 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); |
| 1525 |
if (!args) { |
| 1526 |
goto exit; |
| 1527 |
} |
| 1528 |
a = args[0]; |
| 1529 |
if (!noptargs) { |
| 1530 |
goto skip_optional_pos; |
| 1531 |
} |
| 1532 |
if (args[1]) { |
| 1533 |
b = args[1]; |
| 1534 |
if (!--noptargs) { |
| 1535 |
goto skip_optional_pos; |
| 1536 |
} |
| 1537 |
} |
| 1538 |
skip_optional_pos: |
| 1539 |
if (!noptargs) { |
| 1540 |
goto skip_optional_kwonly; |
| 1541 |
} |
| 1542 |
if (args[2]) { |
| 1543 |
c = args[2]; |
| 1544 |
if (!--noptargs) { |
| 1545 |
goto skip_optional_kwonly; |
| 1546 |
} |
| 1547 |
} |
| 1548 |
d = args[3]; |
| 1549 |
skip_optional_kwonly: |
| 1550 |
return_value = keywords_opt_kwonly_impl(module, a, b, c, d); |
| 1551 |
|
| 1552 |
exit: |
| 1553 |
return return_value; |
| 1554 |
} |
| 1555 |
|
| 1556 |
PyDoc_STRVAR(keywords_kwonly_opt__doc__, |
| 1557 |
"keywords_kwonly_opt($module, /, a, *, b=None, c=None)\n" |
| 1558 |
"--\n" |
| 1559 |
"\n"); |
| 1560 |
|
| 1561 |
#define KEYWORDS_KWONLY_OPT_METHODDEF \ |
| 1562 |
{"keywords_kwonly_opt", _PyCFunction_CAST(keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, keywords_kwonly_opt__doc__}, |
| 1563 |
|
| 1564 |
static PyObject * |
| 1565 |
keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1566 |
PyObject *c); |
| 1567 |
|
| 1568 |
static PyObject * |
| 1569 |
keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1570 |
{ |
| 1571 |
PyObject *return_value = NULL; |
| 1572 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1573 |
|
| 1574 |
#define NUM_KEYWORDS 3 |
| 1575 |
static struct { |
| 1576 |
PyGC_Head _this_is_not_used; |
| 1577 |
PyObject_VAR_HEAD |
| 1578 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1579 |
} _kwtuple = { |
| 1580 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1581 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), }, |
| 1582 |
}; |
| 1583 |
#undef NUM_KEYWORDS |
| 1584 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1585 |
|
| 1586 |
#else // !Py_BUILD_CORE |
| 1587 |
# define KWTUPLE NULL |
| 1588 |
#endif // !Py_BUILD_CORE |
| 1589 |
|
| 1590 |
static const char * const _keywords[] = {"a", "b", "c", NULL}; |
| 1591 |
static _PyArg_Parser _parser = { |
| 1592 |
.keywords = _keywords, |
| 1593 |
.fname = "keywords_kwonly_opt", |
| 1594 |
.kwtuple = KWTUPLE, |
| 1595 |
}; |
| 1596 |
#undef KWTUPLE |
| 1597 |
PyObject *argsbuf[3]; |
| 1598 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 1599 |
PyObject *a; |
| 1600 |
PyObject *b = Py_None; |
| 1601 |
PyObject *c = Py_None; |
| 1602 |
|
| 1603 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
| 1604 |
if (!args) { |
| 1605 |
goto exit; |
| 1606 |
} |
| 1607 |
a = args[0]; |
| 1608 |
if (!noptargs) { |
| 1609 |
goto skip_optional_kwonly; |
| 1610 |
} |
| 1611 |
if (args[1]) { |
| 1612 |
b = args[1]; |
| 1613 |
if (!--noptargs) { |
| 1614 |
goto skip_optional_kwonly; |
| 1615 |
} |
| 1616 |
} |
| 1617 |
c = args[2]; |
| 1618 |
skip_optional_kwonly: |
| 1619 |
return_value = keywords_kwonly_opt_impl(module, a, b, c); |
| 1620 |
|
| 1621 |
exit: |
| 1622 |
return return_value; |
| 1623 |
} |
| 1624 |
|
| 1625 |
PyDoc_STRVAR(posonly_keywords__doc__, |
| 1626 |
"posonly_keywords($module, a, /, b)\n" |
| 1627 |
"--\n" |
| 1628 |
"\n"); |
| 1629 |
|
| 1630 |
#define POSONLY_KEYWORDS_METHODDEF \ |
| 1631 |
{"posonly_keywords", _PyCFunction_CAST(posonly_keywords), METH_FASTCALL|METH_KEYWORDS, posonly_keywords__doc__}, |
| 1632 |
|
| 1633 |
static PyObject * |
| 1634 |
posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b); |
| 1635 |
|
| 1636 |
static PyObject * |
| 1637 |
posonly_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1638 |
{ |
| 1639 |
PyObject *return_value = NULL; |
| 1640 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1641 |
|
| 1642 |
#define NUM_KEYWORDS 1 |
| 1643 |
static struct { |
| 1644 |
PyGC_Head _this_is_not_used; |
| 1645 |
PyObject_VAR_HEAD |
| 1646 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1647 |
} _kwtuple = { |
| 1648 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1649 |
.ob_item = { _Py_LATIN1_CHR('b'), }, |
| 1650 |
}; |
| 1651 |
#undef NUM_KEYWORDS |
| 1652 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1653 |
|
| 1654 |
#else // !Py_BUILD_CORE |
| 1655 |
# define KWTUPLE NULL |
| 1656 |
#endif // !Py_BUILD_CORE |
| 1657 |
|
| 1658 |
static const char * const _keywords[] = {"", "b", NULL}; |
| 1659 |
static _PyArg_Parser _parser = { |
| 1660 |
.keywords = _keywords, |
| 1661 |
.fname = "posonly_keywords", |
| 1662 |
.kwtuple = KWTUPLE, |
| 1663 |
}; |
| 1664 |
#undef KWTUPLE |
| 1665 |
PyObject *argsbuf[2]; |
| 1666 |
PyObject *a; |
| 1667 |
PyObject *b; |
| 1668 |
|
| 1669 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); |
| 1670 |
if (!args) { |
| 1671 |
goto exit; |
| 1672 |
} |
| 1673 |
a = args[0]; |
| 1674 |
b = args[1]; |
| 1675 |
return_value = posonly_keywords_impl(module, a, b); |
| 1676 |
|
| 1677 |
exit: |
| 1678 |
return return_value; |
| 1679 |
} |
| 1680 |
|
| 1681 |
PyDoc_STRVAR(posonly_kwonly__doc__, |
| 1682 |
"posonly_kwonly($module, a, /, *, b)\n" |
| 1683 |
"--\n" |
| 1684 |
"\n"); |
| 1685 |
|
| 1686 |
#define POSONLY_KWONLY_METHODDEF \ |
| 1687 |
{"posonly_kwonly", _PyCFunction_CAST(posonly_kwonly), METH_FASTCALL|METH_KEYWORDS, posonly_kwonly__doc__}, |
| 1688 |
|
| 1689 |
static PyObject * |
| 1690 |
posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *b); |
| 1691 |
|
| 1692 |
static PyObject * |
| 1693 |
posonly_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1694 |
{ |
| 1695 |
PyObject *return_value = NULL; |
| 1696 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1697 |
|
| 1698 |
#define NUM_KEYWORDS 1 |
| 1699 |
static struct { |
| 1700 |
PyGC_Head _this_is_not_used; |
| 1701 |
PyObject_VAR_HEAD |
| 1702 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1703 |
} _kwtuple = { |
| 1704 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1705 |
.ob_item = { _Py_LATIN1_CHR('b'), }, |
| 1706 |
}; |
| 1707 |
#undef NUM_KEYWORDS |
| 1708 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1709 |
|
| 1710 |
#else // !Py_BUILD_CORE |
| 1711 |
# define KWTUPLE NULL |
| 1712 |
#endif // !Py_BUILD_CORE |
| 1713 |
|
| 1714 |
static const char * const _keywords[] = {"", "b", NULL}; |
| 1715 |
static _PyArg_Parser _parser = { |
| 1716 |
.keywords = _keywords, |
| 1717 |
.fname = "posonly_kwonly", |
| 1718 |
.kwtuple = KWTUPLE, |
| 1719 |
}; |
| 1720 |
#undef KWTUPLE |
| 1721 |
PyObject *argsbuf[2]; |
| 1722 |
PyObject *a; |
| 1723 |
PyObject *b; |
| 1724 |
|
| 1725 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf); |
| 1726 |
if (!args) { |
| 1727 |
goto exit; |
| 1728 |
} |
| 1729 |
a = args[0]; |
| 1730 |
b = args[1]; |
| 1731 |
return_value = posonly_kwonly_impl(module, a, b); |
| 1732 |
|
| 1733 |
exit: |
| 1734 |
return return_value; |
| 1735 |
} |
| 1736 |
|
| 1737 |
PyDoc_STRVAR(posonly_keywords_kwonly__doc__, |
| 1738 |
"posonly_keywords_kwonly($module, a, /, b, *, c)\n" |
| 1739 |
"--\n" |
| 1740 |
"\n"); |
| 1741 |
|
| 1742 |
#define POSONLY_KEYWORDS_KWONLY_METHODDEF \ |
| 1743 |
{"posonly_keywords_kwonly", _PyCFunction_CAST(posonly_keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_kwonly__doc__}, |
| 1744 |
|
| 1745 |
static PyObject * |
| 1746 |
posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1747 |
PyObject *c); |
| 1748 |
|
| 1749 |
static PyObject * |
| 1750 |
posonly_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1751 |
{ |
| 1752 |
PyObject *return_value = NULL; |
| 1753 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1754 |
|
| 1755 |
#define NUM_KEYWORDS 2 |
| 1756 |
static struct { |
| 1757 |
PyGC_Head _this_is_not_used; |
| 1758 |
PyObject_VAR_HEAD |
| 1759 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1760 |
} _kwtuple = { |
| 1761 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1762 |
.ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), }, |
| 1763 |
}; |
| 1764 |
#undef NUM_KEYWORDS |
| 1765 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1766 |
|
| 1767 |
#else // !Py_BUILD_CORE |
| 1768 |
# define KWTUPLE NULL |
| 1769 |
#endif // !Py_BUILD_CORE |
| 1770 |
|
| 1771 |
static const char * const _keywords[] = {"", "b", "c", NULL}; |
| 1772 |
static _PyArg_Parser _parser = { |
| 1773 |
.keywords = _keywords, |
| 1774 |
.fname = "posonly_keywords_kwonly", |
| 1775 |
.kwtuple = KWTUPLE, |
| 1776 |
}; |
| 1777 |
#undef KWTUPLE |
| 1778 |
PyObject *argsbuf[3]; |
| 1779 |
PyObject *a; |
| 1780 |
PyObject *b; |
| 1781 |
PyObject *c; |
| 1782 |
|
| 1783 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf); |
| 1784 |
if (!args) { |
| 1785 |
goto exit; |
| 1786 |
} |
| 1787 |
a = args[0]; |
| 1788 |
b = args[1]; |
| 1789 |
c = args[2]; |
| 1790 |
return_value = posonly_keywords_kwonly_impl(module, a, b, c); |
| 1791 |
|
| 1792 |
exit: |
| 1793 |
return return_value; |
| 1794 |
} |
| 1795 |
|
| 1796 |
PyDoc_STRVAR(posonly_keywords_opt__doc__, |
| 1797 |
"posonly_keywords_opt($module, a, /, b, c=None, d=None)\n" |
| 1798 |
"--\n" |
| 1799 |
"\n"); |
| 1800 |
|
| 1801 |
#define POSONLY_KEYWORDS_OPT_METHODDEF \ |
| 1802 |
{"posonly_keywords_opt", _PyCFunction_CAST(posonly_keywords_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_opt__doc__}, |
| 1803 |
|
| 1804 |
static PyObject * |
| 1805 |
posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1806 |
PyObject *c, PyObject *d); |
| 1807 |
|
| 1808 |
static PyObject * |
| 1809 |
posonly_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1810 |
{ |
| 1811 |
PyObject *return_value = NULL; |
| 1812 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1813 |
|
| 1814 |
#define NUM_KEYWORDS 3 |
| 1815 |
static struct { |
| 1816 |
PyGC_Head _this_is_not_used; |
| 1817 |
PyObject_VAR_HEAD |
| 1818 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1819 |
} _kwtuple = { |
| 1820 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1821 |
.ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 1822 |
}; |
| 1823 |
#undef NUM_KEYWORDS |
| 1824 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1825 |
|
| 1826 |
#else // !Py_BUILD_CORE |
| 1827 |
# define KWTUPLE NULL |
| 1828 |
#endif // !Py_BUILD_CORE |
| 1829 |
|
| 1830 |
static const char * const _keywords[] = {"", "b", "c", "d", NULL}; |
| 1831 |
static _PyArg_Parser _parser = { |
| 1832 |
.keywords = _keywords, |
| 1833 |
.fname = "posonly_keywords_opt", |
| 1834 |
.kwtuple = KWTUPLE, |
| 1835 |
}; |
| 1836 |
#undef KWTUPLE |
| 1837 |
PyObject *argsbuf[4]; |
| 1838 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; |
| 1839 |
PyObject *a; |
| 1840 |
PyObject *b; |
| 1841 |
PyObject *c = Py_None; |
| 1842 |
PyObject *d = Py_None; |
| 1843 |
|
| 1844 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf); |
| 1845 |
if (!args) { |
| 1846 |
goto exit; |
| 1847 |
} |
| 1848 |
a = args[0]; |
| 1849 |
b = args[1]; |
| 1850 |
if (!noptargs) { |
| 1851 |
goto skip_optional_pos; |
| 1852 |
} |
| 1853 |
if (args[2]) { |
| 1854 |
c = args[2]; |
| 1855 |
if (!--noptargs) { |
| 1856 |
goto skip_optional_pos; |
| 1857 |
} |
| 1858 |
} |
| 1859 |
d = args[3]; |
| 1860 |
skip_optional_pos: |
| 1861 |
return_value = posonly_keywords_opt_impl(module, a, b, c, d); |
| 1862 |
|
| 1863 |
exit: |
| 1864 |
return return_value; |
| 1865 |
} |
| 1866 |
|
| 1867 |
PyDoc_STRVAR(posonly_opt_keywords_opt__doc__, |
| 1868 |
"posonly_opt_keywords_opt($module, a, b=None, /, c=None, d=None)\n" |
| 1869 |
"--\n" |
| 1870 |
"\n"); |
| 1871 |
|
| 1872 |
#define POSONLY_OPT_KEYWORDS_OPT_METHODDEF \ |
| 1873 |
{"posonly_opt_keywords_opt", _PyCFunction_CAST(posonly_opt_keywords_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_keywords_opt__doc__}, |
| 1874 |
|
| 1875 |
static PyObject * |
| 1876 |
posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1877 |
PyObject *c, PyObject *d); |
| 1878 |
|
| 1879 |
static PyObject * |
| 1880 |
posonly_opt_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1881 |
{ |
| 1882 |
PyObject *return_value = NULL; |
| 1883 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1884 |
|
| 1885 |
#define NUM_KEYWORDS 2 |
| 1886 |
static struct { |
| 1887 |
PyGC_Head _this_is_not_used; |
| 1888 |
PyObject_VAR_HEAD |
| 1889 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1890 |
} _kwtuple = { |
| 1891 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1892 |
.ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 1893 |
}; |
| 1894 |
#undef NUM_KEYWORDS |
| 1895 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1896 |
|
| 1897 |
#else // !Py_BUILD_CORE |
| 1898 |
# define KWTUPLE NULL |
| 1899 |
#endif // !Py_BUILD_CORE |
| 1900 |
|
| 1901 |
static const char * const _keywords[] = {"", "", "c", "d", NULL}; |
| 1902 |
static _PyArg_Parser _parser = { |
| 1903 |
.keywords = _keywords, |
| 1904 |
.fname = "posonly_opt_keywords_opt", |
| 1905 |
.kwtuple = KWTUPLE, |
| 1906 |
}; |
| 1907 |
#undef KWTUPLE |
| 1908 |
PyObject *argsbuf[4]; |
| 1909 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 1910 |
PyObject *a; |
| 1911 |
PyObject *b = Py_None; |
| 1912 |
PyObject *c = Py_None; |
| 1913 |
PyObject *d = Py_None; |
| 1914 |
|
| 1915 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); |
| 1916 |
if (!args) { |
| 1917 |
goto exit; |
| 1918 |
} |
| 1919 |
a = args[0]; |
| 1920 |
if (nargs < 2) { |
| 1921 |
goto skip_optional_posonly; |
| 1922 |
} |
| 1923 |
noptargs--; |
| 1924 |
b = args[1]; |
| 1925 |
skip_optional_posonly: |
| 1926 |
if (!noptargs) { |
| 1927 |
goto skip_optional_pos; |
| 1928 |
} |
| 1929 |
if (args[2]) { |
| 1930 |
c = args[2]; |
| 1931 |
if (!--noptargs) { |
| 1932 |
goto skip_optional_pos; |
| 1933 |
} |
| 1934 |
} |
| 1935 |
d = args[3]; |
| 1936 |
skip_optional_pos: |
| 1937 |
return_value = posonly_opt_keywords_opt_impl(module, a, b, c, d); |
| 1938 |
|
| 1939 |
exit: |
| 1940 |
return return_value; |
| 1941 |
} |
| 1942 |
|
| 1943 |
PyDoc_STRVAR(posonly_kwonly_opt__doc__, |
| 1944 |
"posonly_kwonly_opt($module, a, /, *, b, c=None, d=None)\n" |
| 1945 |
"--\n" |
| 1946 |
"\n"); |
| 1947 |
|
| 1948 |
#define POSONLY_KWONLY_OPT_METHODDEF \ |
| 1949 |
{"posonly_kwonly_opt", _PyCFunction_CAST(posonly_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_kwonly_opt__doc__}, |
| 1950 |
|
| 1951 |
static PyObject * |
| 1952 |
posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 1953 |
PyObject *c, PyObject *d); |
| 1954 |
|
| 1955 |
static PyObject * |
| 1956 |
posonly_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 1957 |
{ |
| 1958 |
PyObject *return_value = NULL; |
| 1959 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 1960 |
|
| 1961 |
#define NUM_KEYWORDS 3 |
| 1962 |
static struct { |
| 1963 |
PyGC_Head _this_is_not_used; |
| 1964 |
PyObject_VAR_HEAD |
| 1965 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 1966 |
} _kwtuple = { |
| 1967 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 1968 |
.ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 1969 |
}; |
| 1970 |
#undef NUM_KEYWORDS |
| 1971 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 1972 |
|
| 1973 |
#else // !Py_BUILD_CORE |
| 1974 |
# define KWTUPLE NULL |
| 1975 |
#endif // !Py_BUILD_CORE |
| 1976 |
|
| 1977 |
static const char * const _keywords[] = {"", "b", "c", "d", NULL}; |
| 1978 |
static _PyArg_Parser _parser = { |
| 1979 |
.keywords = _keywords, |
| 1980 |
.fname = "posonly_kwonly_opt", |
| 1981 |
.kwtuple = KWTUPLE, |
| 1982 |
}; |
| 1983 |
#undef KWTUPLE |
| 1984 |
PyObject *argsbuf[4]; |
| 1985 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; |
| 1986 |
PyObject *a; |
| 1987 |
PyObject *b; |
| 1988 |
PyObject *c = Py_None; |
| 1989 |
PyObject *d = Py_None; |
| 1990 |
|
| 1991 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf); |
| 1992 |
if (!args) { |
| 1993 |
goto exit; |
| 1994 |
} |
| 1995 |
a = args[0]; |
| 1996 |
b = args[1]; |
| 1997 |
if (!noptargs) { |
| 1998 |
goto skip_optional_kwonly; |
| 1999 |
} |
| 2000 |
if (args[2]) { |
| 2001 |
c = args[2]; |
| 2002 |
if (!--noptargs) { |
| 2003 |
goto skip_optional_kwonly; |
| 2004 |
} |
| 2005 |
} |
| 2006 |
d = args[3]; |
| 2007 |
skip_optional_kwonly: |
| 2008 |
return_value = posonly_kwonly_opt_impl(module, a, b, c, d); |
| 2009 |
|
| 2010 |
exit: |
| 2011 |
return return_value; |
| 2012 |
} |
| 2013 |
|
| 2014 |
PyDoc_STRVAR(posonly_opt_kwonly_opt__doc__, |
| 2015 |
"posonly_opt_kwonly_opt($module, a, b=None, /, *, c=None, d=None)\n" |
| 2016 |
"--\n" |
| 2017 |
"\n"); |
| 2018 |
|
| 2019 |
#define POSONLY_OPT_KWONLY_OPT_METHODDEF \ |
| 2020 |
{"posonly_opt_kwonly_opt", _PyCFunction_CAST(posonly_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_kwonly_opt__doc__}, |
| 2021 |
|
| 2022 |
static PyObject * |
| 2023 |
posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 2024 |
PyObject *c, PyObject *d); |
| 2025 |
|
| 2026 |
static PyObject * |
| 2027 |
posonly_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2028 |
{ |
| 2029 |
PyObject *return_value = NULL; |
| 2030 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2031 |
|
| 2032 |
#define NUM_KEYWORDS 2 |
| 2033 |
static struct { |
| 2034 |
PyGC_Head _this_is_not_used; |
| 2035 |
PyObject_VAR_HEAD |
| 2036 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2037 |
} _kwtuple = { |
| 2038 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2039 |
.ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 2040 |
}; |
| 2041 |
#undef NUM_KEYWORDS |
| 2042 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2043 |
|
| 2044 |
#else // !Py_BUILD_CORE |
| 2045 |
# define KWTUPLE NULL |
| 2046 |
#endif // !Py_BUILD_CORE |
| 2047 |
|
| 2048 |
static const char * const _keywords[] = {"", "", "c", "d", NULL}; |
| 2049 |
static _PyArg_Parser _parser = { |
| 2050 |
.keywords = _keywords, |
| 2051 |
.fname = "posonly_opt_kwonly_opt", |
| 2052 |
.kwtuple = KWTUPLE, |
| 2053 |
}; |
| 2054 |
#undef KWTUPLE |
| 2055 |
PyObject *argsbuf[4]; |
| 2056 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2057 |
PyObject *a; |
| 2058 |
PyObject *b = Py_None; |
| 2059 |
PyObject *c = Py_None; |
| 2060 |
PyObject *d = Py_None; |
| 2061 |
|
| 2062 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); |
| 2063 |
if (!args) { |
| 2064 |
goto exit; |
| 2065 |
} |
| 2066 |
a = args[0]; |
| 2067 |
if (nargs < 2) { |
| 2068 |
goto skip_optional_posonly; |
| 2069 |
} |
| 2070 |
noptargs--; |
| 2071 |
b = args[1]; |
| 2072 |
skip_optional_posonly: |
| 2073 |
if (!noptargs) { |
| 2074 |
goto skip_optional_kwonly; |
| 2075 |
} |
| 2076 |
if (args[2]) { |
| 2077 |
c = args[2]; |
| 2078 |
if (!--noptargs) { |
| 2079 |
goto skip_optional_kwonly; |
| 2080 |
} |
| 2081 |
} |
| 2082 |
d = args[3]; |
| 2083 |
skip_optional_kwonly: |
| 2084 |
return_value = posonly_opt_kwonly_opt_impl(module, a, b, c, d); |
| 2085 |
|
| 2086 |
exit: |
| 2087 |
return return_value; |
| 2088 |
} |
| 2089 |
|
| 2090 |
PyDoc_STRVAR(posonly_keywords_kwonly_opt__doc__, |
| 2091 |
"posonly_keywords_kwonly_opt($module, a, /, b, *, c, d=None, e=None)\n" |
| 2092 |
"--\n" |
| 2093 |
"\n"); |
| 2094 |
|
| 2095 |
#define POSONLY_KEYWORDS_KWONLY_OPT_METHODDEF \ |
| 2096 |
{"posonly_keywords_kwonly_opt", _PyCFunction_CAST(posonly_keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_kwonly_opt__doc__}, |
| 2097 |
|
| 2098 |
static PyObject * |
| 2099 |
posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b, |
| 2100 |
PyObject *c, PyObject *d, PyObject *e); |
| 2101 |
|
| 2102 |
static PyObject * |
| 2103 |
posonly_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2104 |
{ |
| 2105 |
PyObject *return_value = NULL; |
| 2106 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2107 |
|
| 2108 |
#define NUM_KEYWORDS 4 |
| 2109 |
static struct { |
| 2110 |
PyGC_Head _this_is_not_used; |
| 2111 |
PyObject_VAR_HEAD |
| 2112 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2113 |
} _kwtuple = { |
| 2114 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2115 |
.ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), }, |
| 2116 |
}; |
| 2117 |
#undef NUM_KEYWORDS |
| 2118 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2119 |
|
| 2120 |
#else // !Py_BUILD_CORE |
| 2121 |
# define KWTUPLE NULL |
| 2122 |
#endif // !Py_BUILD_CORE |
| 2123 |
|
| 2124 |
static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL}; |
| 2125 |
static _PyArg_Parser _parser = { |
| 2126 |
.keywords = _keywords, |
| 2127 |
.fname = "posonly_keywords_kwonly_opt", |
| 2128 |
.kwtuple = KWTUPLE, |
| 2129 |
}; |
| 2130 |
#undef KWTUPLE |
| 2131 |
PyObject *argsbuf[5]; |
| 2132 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; |
| 2133 |
PyObject *a; |
| 2134 |
PyObject *b; |
| 2135 |
PyObject *c; |
| 2136 |
PyObject *d = Py_None; |
| 2137 |
PyObject *e = Py_None; |
| 2138 |
|
| 2139 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf); |
| 2140 |
if (!args) { |
| 2141 |
goto exit; |
| 2142 |
} |
| 2143 |
a = args[0]; |
| 2144 |
b = args[1]; |
| 2145 |
c = args[2]; |
| 2146 |
if (!noptargs) { |
| 2147 |
goto skip_optional_kwonly; |
| 2148 |
} |
| 2149 |
if (args[3]) { |
| 2150 |
d = args[3]; |
| 2151 |
if (!--noptargs) { |
| 2152 |
goto skip_optional_kwonly; |
| 2153 |
} |
| 2154 |
} |
| 2155 |
e = args[4]; |
| 2156 |
skip_optional_kwonly: |
| 2157 |
return_value = posonly_keywords_kwonly_opt_impl(module, a, b, c, d, e); |
| 2158 |
|
| 2159 |
exit: |
| 2160 |
return return_value; |
| 2161 |
} |
| 2162 |
|
| 2163 |
PyDoc_STRVAR(posonly_keywords_opt_kwonly_opt__doc__, |
| 2164 |
"posonly_keywords_opt_kwonly_opt($module, a, /, b, c=None, *, d=None,\n" |
| 2165 |
" e=None)\n" |
| 2166 |
"--\n" |
| 2167 |
"\n"); |
| 2168 |
|
| 2169 |
#define POSONLY_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \ |
| 2170 |
{"posonly_keywords_opt_kwonly_opt", _PyCFunction_CAST(posonly_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_opt_kwonly_opt__doc__}, |
| 2171 |
|
| 2172 |
static PyObject * |
| 2173 |
posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a, |
| 2174 |
PyObject *b, PyObject *c, PyObject *d, |
| 2175 |
PyObject *e); |
| 2176 |
|
| 2177 |
static PyObject * |
| 2178 |
posonly_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2179 |
{ |
| 2180 |
PyObject *return_value = NULL; |
| 2181 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2182 |
|
| 2183 |
#define NUM_KEYWORDS 4 |
| 2184 |
static struct { |
| 2185 |
PyGC_Head _this_is_not_used; |
| 2186 |
PyObject_VAR_HEAD |
| 2187 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2188 |
} _kwtuple = { |
| 2189 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2190 |
.ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), }, |
| 2191 |
}; |
| 2192 |
#undef NUM_KEYWORDS |
| 2193 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2194 |
|
| 2195 |
#else // !Py_BUILD_CORE |
| 2196 |
# define KWTUPLE NULL |
| 2197 |
#endif // !Py_BUILD_CORE |
| 2198 |
|
| 2199 |
static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL}; |
| 2200 |
static _PyArg_Parser _parser = { |
| 2201 |
.keywords = _keywords, |
| 2202 |
.fname = "posonly_keywords_opt_kwonly_opt", |
| 2203 |
.kwtuple = KWTUPLE, |
| 2204 |
}; |
| 2205 |
#undef KWTUPLE |
| 2206 |
PyObject *argsbuf[5]; |
| 2207 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; |
| 2208 |
PyObject *a; |
| 2209 |
PyObject *b; |
| 2210 |
PyObject *c = Py_None; |
| 2211 |
PyObject *d = Py_None; |
| 2212 |
PyObject *e = Py_None; |
| 2213 |
|
| 2214 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); |
| 2215 |
if (!args) { |
| 2216 |
goto exit; |
| 2217 |
} |
| 2218 |
a = args[0]; |
| 2219 |
b = args[1]; |
| 2220 |
if (!noptargs) { |
| 2221 |
goto skip_optional_pos; |
| 2222 |
} |
| 2223 |
if (args[2]) { |
| 2224 |
c = args[2]; |
| 2225 |
if (!--noptargs) { |
| 2226 |
goto skip_optional_pos; |
| 2227 |
} |
| 2228 |
} |
| 2229 |
skip_optional_pos: |
| 2230 |
if (!noptargs) { |
| 2231 |
goto skip_optional_kwonly; |
| 2232 |
} |
| 2233 |
if (args[3]) { |
| 2234 |
d = args[3]; |
| 2235 |
if (!--noptargs) { |
| 2236 |
goto skip_optional_kwonly; |
| 2237 |
} |
| 2238 |
} |
| 2239 |
e = args[4]; |
| 2240 |
skip_optional_kwonly: |
| 2241 |
return_value = posonly_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e); |
| 2242 |
|
| 2243 |
exit: |
| 2244 |
return return_value; |
| 2245 |
} |
| 2246 |
|
| 2247 |
PyDoc_STRVAR(posonly_opt_keywords_opt_kwonly_opt__doc__, |
| 2248 |
"posonly_opt_keywords_opt_kwonly_opt($module, a, b=None, /, c=None, *,\n" |
| 2249 |
" d=None)\n" |
| 2250 |
"--\n" |
| 2251 |
"\n"); |
| 2252 |
|
| 2253 |
#define POSONLY_OPT_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \ |
| 2254 |
{"posonly_opt_keywords_opt_kwonly_opt", _PyCFunction_CAST(posonly_opt_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_keywords_opt_kwonly_opt__doc__}, |
| 2255 |
|
| 2256 |
static PyObject * |
| 2257 |
posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a, |
| 2258 |
PyObject *b, PyObject *c, |
| 2259 |
PyObject *d); |
| 2260 |
|
| 2261 |
static PyObject * |
| 2262 |
posonly_opt_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2263 |
{ |
| 2264 |
PyObject *return_value = NULL; |
| 2265 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2266 |
|
| 2267 |
#define NUM_KEYWORDS 2 |
| 2268 |
static struct { |
| 2269 |
PyGC_Head _this_is_not_used; |
| 2270 |
PyObject_VAR_HEAD |
| 2271 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2272 |
} _kwtuple = { |
| 2273 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2274 |
.ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), }, |
| 2275 |
}; |
| 2276 |
#undef NUM_KEYWORDS |
| 2277 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2278 |
|
| 2279 |
#else // !Py_BUILD_CORE |
| 2280 |
# define KWTUPLE NULL |
| 2281 |
#endif // !Py_BUILD_CORE |
| 2282 |
|
| 2283 |
static const char * const _keywords[] = {"", "", "c", "d", NULL}; |
| 2284 |
static _PyArg_Parser _parser = { |
| 2285 |
.keywords = _keywords, |
| 2286 |
.fname = "posonly_opt_keywords_opt_kwonly_opt", |
| 2287 |
.kwtuple = KWTUPLE, |
| 2288 |
}; |
| 2289 |
#undef KWTUPLE |
| 2290 |
PyObject *argsbuf[4]; |
| 2291 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2292 |
PyObject *a; |
| 2293 |
PyObject *b = Py_None; |
| 2294 |
PyObject *c = Py_None; |
| 2295 |
PyObject *d = Py_None; |
| 2296 |
|
| 2297 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); |
| 2298 |
if (!args) { |
| 2299 |
goto exit; |
| 2300 |
} |
| 2301 |
a = args[0]; |
| 2302 |
if (nargs < 2) { |
| 2303 |
goto skip_optional_posonly; |
| 2304 |
} |
| 2305 |
noptargs--; |
| 2306 |
b = args[1]; |
| 2307 |
skip_optional_posonly: |
| 2308 |
if (!noptargs) { |
| 2309 |
goto skip_optional_pos; |
| 2310 |
} |
| 2311 |
if (args[2]) { |
| 2312 |
c = args[2]; |
| 2313 |
if (!--noptargs) { |
| 2314 |
goto skip_optional_pos; |
| 2315 |
} |
| 2316 |
} |
| 2317 |
skip_optional_pos: |
| 2318 |
if (!noptargs) { |
| 2319 |
goto skip_optional_kwonly; |
| 2320 |
} |
| 2321 |
d = args[3]; |
| 2322 |
skip_optional_kwonly: |
| 2323 |
return_value = posonly_opt_keywords_opt_kwonly_opt_impl(module, a, b, c, d); |
| 2324 |
|
| 2325 |
exit: |
| 2326 |
return return_value; |
| 2327 |
} |
| 2328 |
|
| 2329 |
PyDoc_STRVAR(keyword_only_parameter__doc__, |
| 2330 |
"keyword_only_parameter($module, /, *, a)\n" |
| 2331 |
"--\n" |
| 2332 |
"\n"); |
| 2333 |
|
| 2334 |
#define KEYWORD_ONLY_PARAMETER_METHODDEF \ |
| 2335 |
{"keyword_only_parameter", _PyCFunction_CAST(keyword_only_parameter), METH_FASTCALL|METH_KEYWORDS, keyword_only_parameter__doc__}, |
| 2336 |
|
| 2337 |
static PyObject * |
| 2338 |
keyword_only_parameter_impl(PyObject *module, PyObject *a); |
| 2339 |
|
| 2340 |
static PyObject * |
| 2341 |
keyword_only_parameter(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2342 |
{ |
| 2343 |
PyObject *return_value = NULL; |
| 2344 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2345 |
|
| 2346 |
#define NUM_KEYWORDS 1 |
| 2347 |
static struct { |
| 2348 |
PyGC_Head _this_is_not_used; |
| 2349 |
PyObject_VAR_HEAD |
| 2350 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2351 |
} _kwtuple = { |
| 2352 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2353 |
.ob_item = { _Py_LATIN1_CHR('a'), }, |
| 2354 |
}; |
| 2355 |
#undef NUM_KEYWORDS |
| 2356 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2357 |
|
| 2358 |
#else // !Py_BUILD_CORE |
| 2359 |
# define KWTUPLE NULL |
| 2360 |
#endif // !Py_BUILD_CORE |
| 2361 |
|
| 2362 |
static const char * const _keywords[] = {"a", NULL}; |
| 2363 |
static _PyArg_Parser _parser = { |
| 2364 |
.keywords = _keywords, |
| 2365 |
.fname = "keyword_only_parameter", |
| 2366 |
.kwtuple = KWTUPLE, |
| 2367 |
}; |
| 2368 |
#undef KWTUPLE |
| 2369 |
PyObject *argsbuf[1]; |
| 2370 |
PyObject *a; |
| 2371 |
|
| 2372 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 1, argsbuf); |
| 2373 |
if (!args) { |
| 2374 |
goto exit; |
| 2375 |
} |
| 2376 |
a = args[0]; |
| 2377 |
return_value = keyword_only_parameter_impl(module, a); |
| 2378 |
|
| 2379 |
exit: |
| 2380 |
return return_value; |
| 2381 |
} |
| 2382 |
|
| 2383 |
PyDoc_STRVAR(posonly_vararg__doc__, |
| 2384 |
"posonly_vararg($module, a, /, b, *args)\n" |
| 2385 |
"--\n" |
| 2386 |
"\n"); |
| 2387 |
|
| 2388 |
#define POSONLY_VARARG_METHODDEF \ |
| 2389 |
{"posonly_vararg", _PyCFunction_CAST(posonly_vararg), METH_FASTCALL|METH_KEYWORDS, posonly_vararg__doc__}, |
| 2390 |
|
| 2391 |
static PyObject * |
| 2392 |
posonly_vararg_impl(PyObject *module, PyObject *a, PyObject *b, |
| 2393 |
PyObject *args); |
| 2394 |
|
| 2395 |
static PyObject * |
| 2396 |
posonly_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2397 |
{ |
| 2398 |
PyObject *return_value = NULL; |
| 2399 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2400 |
|
| 2401 |
#define NUM_KEYWORDS 1 |
| 2402 |
static struct { |
| 2403 |
PyGC_Head _this_is_not_used; |
| 2404 |
PyObject_VAR_HEAD |
| 2405 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2406 |
} _kwtuple = { |
| 2407 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2408 |
.ob_item = { _Py_LATIN1_CHR('b'), }, |
| 2409 |
}; |
| 2410 |
#undef NUM_KEYWORDS |
| 2411 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2412 |
|
| 2413 |
#else // !Py_BUILD_CORE |
| 2414 |
# define KWTUPLE NULL |
| 2415 |
#endif // !Py_BUILD_CORE |
| 2416 |
|
| 2417 |
static const char * const _keywords[] = {"", "b", NULL}; |
| 2418 |
static _PyArg_Parser _parser = { |
| 2419 |
.keywords = _keywords, |
| 2420 |
.fname = "posonly_vararg", |
| 2421 |
.kwtuple = KWTUPLE, |
| 2422 |
}; |
| 2423 |
#undef KWTUPLE |
| 2424 |
PyObject *argsbuf[3]; |
| 2425 |
PyObject *a; |
| 2426 |
PyObject *b; |
| 2427 |
PyObject *__clinic_args = NULL; |
| 2428 |
|
| 2429 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, 2, argsbuf); |
| 2430 |
if (!args) { |
| 2431 |
goto exit; |
| 2432 |
} |
| 2433 |
a = args[0]; |
| 2434 |
b = args[1]; |
| 2435 |
__clinic_args = args[2]; |
| 2436 |
return_value = posonly_vararg_impl(module, a, b, __clinic_args); |
| 2437 |
|
| 2438 |
exit: |
| 2439 |
Py_XDECREF(__clinic_args); |
| 2440 |
return return_value; |
| 2441 |
} |
| 2442 |
|
| 2443 |
PyDoc_STRVAR(vararg__doc__, |
| 2444 |
"vararg($module, /, a, *args)\n" |
| 2445 |
"--\n" |
| 2446 |
"\n"); |
| 2447 |
|
| 2448 |
#define VARARG_METHODDEF \ |
| 2449 |
{"vararg", _PyCFunction_CAST(vararg), METH_FASTCALL|METH_KEYWORDS, vararg__doc__}, |
| 2450 |
|
| 2451 |
static PyObject * |
| 2452 |
vararg_impl(PyObject *module, PyObject *a, PyObject *args); |
| 2453 |
|
| 2454 |
static PyObject * |
| 2455 |
vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2456 |
{ |
| 2457 |
PyObject *return_value = NULL; |
| 2458 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2459 |
|
| 2460 |
#define NUM_KEYWORDS 1 |
| 2461 |
static struct { |
| 2462 |
PyGC_Head _this_is_not_used; |
| 2463 |
PyObject_VAR_HEAD |
| 2464 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2465 |
} _kwtuple = { |
| 2466 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2467 |
.ob_item = { _Py_LATIN1_CHR('a'), }, |
| 2468 |
}; |
| 2469 |
#undef NUM_KEYWORDS |
| 2470 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2471 |
|
| 2472 |
#else // !Py_BUILD_CORE |
| 2473 |
# define KWTUPLE NULL |
| 2474 |
#endif // !Py_BUILD_CORE |
| 2475 |
|
| 2476 |
static const char * const _keywords[] = {"a", NULL}; |
| 2477 |
static _PyArg_Parser _parser = { |
| 2478 |
.keywords = _keywords, |
| 2479 |
.fname = "vararg", |
| 2480 |
.kwtuple = KWTUPLE, |
| 2481 |
}; |
| 2482 |
#undef KWTUPLE |
| 2483 |
PyObject *argsbuf[2]; |
| 2484 |
PyObject *a; |
| 2485 |
PyObject *__clinic_args = NULL; |
| 2486 |
|
| 2487 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf); |
| 2488 |
if (!args) { |
| 2489 |
goto exit; |
| 2490 |
} |
| 2491 |
a = args[0]; |
| 2492 |
__clinic_args = args[1]; |
| 2493 |
return_value = vararg_impl(module, a, __clinic_args); |
| 2494 |
|
| 2495 |
exit: |
| 2496 |
Py_XDECREF(__clinic_args); |
| 2497 |
return return_value; |
| 2498 |
} |
| 2499 |
|
| 2500 |
PyDoc_STRVAR(vararg_with_default__doc__, |
| 2501 |
"vararg_with_default($module, /, a, *args, b=False)\n" |
| 2502 |
"--\n" |
| 2503 |
"\n"); |
| 2504 |
|
| 2505 |
#define VARARG_WITH_DEFAULT_METHODDEF \ |
| 2506 |
{"vararg_with_default", _PyCFunction_CAST(vararg_with_default), METH_FASTCALL|METH_KEYWORDS, vararg_with_default__doc__}, |
| 2507 |
|
| 2508 |
static PyObject * |
| 2509 |
vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args, |
| 2510 |
int b); |
| 2511 |
|
| 2512 |
static PyObject * |
| 2513 |
vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2514 |
{ |
| 2515 |
PyObject *return_value = NULL; |
| 2516 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2517 |
|
| 2518 |
#define NUM_KEYWORDS 2 |
| 2519 |
static struct { |
| 2520 |
PyGC_Head _this_is_not_used; |
| 2521 |
PyObject_VAR_HEAD |
| 2522 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2523 |
} _kwtuple = { |
| 2524 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2525 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), }, |
| 2526 |
}; |
| 2527 |
#undef NUM_KEYWORDS |
| 2528 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2529 |
|
| 2530 |
#else // !Py_BUILD_CORE |
| 2531 |
# define KWTUPLE NULL |
| 2532 |
#endif // !Py_BUILD_CORE |
| 2533 |
|
| 2534 |
static const char * const _keywords[] = {"a", "b", NULL}; |
| 2535 |
static _PyArg_Parser _parser = { |
| 2536 |
.keywords = _keywords, |
| 2537 |
.fname = "vararg_with_default", |
| 2538 |
.kwtuple = KWTUPLE, |
| 2539 |
}; |
| 2540 |
#undef KWTUPLE |
| 2541 |
PyObject *argsbuf[3]; |
| 2542 |
Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2543 |
PyObject *a; |
| 2544 |
PyObject *__clinic_args = NULL; |
| 2545 |
int b = 0; |
| 2546 |
|
| 2547 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf); |
| 2548 |
if (!args) { |
| 2549 |
goto exit; |
| 2550 |
} |
| 2551 |
a = args[0]; |
| 2552 |
__clinic_args = args[1]; |
| 2553 |
if (!noptargs) { |
| 2554 |
goto skip_optional_kwonly; |
| 2555 |
} |
| 2556 |
b = PyObject_IsTrue(args[2]); |
| 2557 |
if (b < 0) { |
| 2558 |
goto exit; |
| 2559 |
} |
| 2560 |
skip_optional_kwonly: |
| 2561 |
return_value = vararg_with_default_impl(module, a, __clinic_args, b); |
| 2562 |
|
| 2563 |
exit: |
| 2564 |
Py_XDECREF(__clinic_args); |
| 2565 |
return return_value; |
| 2566 |
} |
| 2567 |
|
| 2568 |
PyDoc_STRVAR(vararg_with_default2__doc__, |
| 2569 |
"vararg_with_default2($module, /, a, *args, b=None, c=None)\n" |
| 2570 |
"--\n" |
| 2571 |
"\n"); |
| 2572 |
|
| 2573 |
#define VARARG_WITH_DEFAULT2_METHODDEF \ |
| 2574 |
{"vararg_with_default2", _PyCFunction_CAST(vararg_with_default2), METH_FASTCALL|METH_KEYWORDS, vararg_with_default2__doc__}, |
| 2575 |
|
| 2576 |
static PyObject * |
| 2577 |
vararg_with_default2_impl(PyObject *module, PyObject *a, PyObject *args, |
| 2578 |
PyObject *b, PyObject *c); |
| 2579 |
|
| 2580 |
static PyObject * |
| 2581 |
vararg_with_default2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2582 |
{ |
| 2583 |
PyObject *return_value = NULL; |
| 2584 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2585 |
|
| 2586 |
#define NUM_KEYWORDS 3 |
| 2587 |
static struct { |
| 2588 |
PyGC_Head _this_is_not_used; |
| 2589 |
PyObject_VAR_HEAD |
| 2590 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2591 |
} _kwtuple = { |
| 2592 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2593 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), }, |
| 2594 |
}; |
| 2595 |
#undef NUM_KEYWORDS |
| 2596 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2597 |
|
| 2598 |
#else // !Py_BUILD_CORE |
| 2599 |
# define KWTUPLE NULL |
| 2600 |
#endif // !Py_BUILD_CORE |
| 2601 |
|
| 2602 |
static const char * const _keywords[] = {"a", "b", "c", NULL}; |
| 2603 |
static _PyArg_Parser _parser = { |
| 2604 |
.keywords = _keywords, |
| 2605 |
.fname = "vararg_with_default2", |
| 2606 |
.kwtuple = KWTUPLE, |
| 2607 |
}; |
| 2608 |
#undef KWTUPLE |
| 2609 |
PyObject *argsbuf[4]; |
| 2610 |
Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2611 |
PyObject *a; |
| 2612 |
PyObject *__clinic_args = NULL; |
| 2613 |
PyObject *b = Py_None; |
| 2614 |
PyObject *c = Py_None; |
| 2615 |
|
| 2616 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf); |
| 2617 |
if (!args) { |
| 2618 |
goto exit; |
| 2619 |
} |
| 2620 |
a = args[0]; |
| 2621 |
__clinic_args = args[1]; |
| 2622 |
if (!noptargs) { |
| 2623 |
goto skip_optional_kwonly; |
| 2624 |
} |
| 2625 |
if (args[2]) { |
| 2626 |
b = args[2]; |
| 2627 |
if (!--noptargs) { |
| 2628 |
goto skip_optional_kwonly; |
| 2629 |
} |
| 2630 |
} |
| 2631 |
c = args[3]; |
| 2632 |
skip_optional_kwonly: |
| 2633 |
return_value = vararg_with_default2_impl(module, a, __clinic_args, b, c); |
| 2634 |
|
| 2635 |
exit: |
| 2636 |
Py_XDECREF(__clinic_args); |
| 2637 |
return return_value; |
| 2638 |
} |
| 2639 |
|
| 2640 |
PyDoc_STRVAR(vararg_with_only_defaults__doc__, |
| 2641 |
"vararg_with_only_defaults($module, /, *args, b=None)\n" |
| 2642 |
"--\n" |
| 2643 |
"\n"); |
| 2644 |
|
| 2645 |
#define VARARG_WITH_ONLY_DEFAULTS_METHODDEF \ |
| 2646 |
{"vararg_with_only_defaults", _PyCFunction_CAST(vararg_with_only_defaults), METH_FASTCALL|METH_KEYWORDS, vararg_with_only_defaults__doc__}, |
| 2647 |
|
| 2648 |
static PyObject * |
| 2649 |
vararg_with_only_defaults_impl(PyObject *module, PyObject *args, PyObject *b); |
| 2650 |
|
| 2651 |
static PyObject * |
| 2652 |
vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2653 |
{ |
| 2654 |
PyObject *return_value = NULL; |
| 2655 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2656 |
|
| 2657 |
#define NUM_KEYWORDS 1 |
| 2658 |
static struct { |
| 2659 |
PyGC_Head _this_is_not_used; |
| 2660 |
PyObject_VAR_HEAD |
| 2661 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2662 |
} _kwtuple = { |
| 2663 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2664 |
.ob_item = { _Py_LATIN1_CHR('b'), }, |
| 2665 |
}; |
| 2666 |
#undef NUM_KEYWORDS |
| 2667 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2668 |
|
| 2669 |
#else // !Py_BUILD_CORE |
| 2670 |
# define KWTUPLE NULL |
| 2671 |
#endif // !Py_BUILD_CORE |
| 2672 |
|
| 2673 |
static const char * const _keywords[] = {"b", NULL}; |
| 2674 |
static _PyArg_Parser _parser = { |
| 2675 |
.keywords = _keywords, |
| 2676 |
.fname = "vararg_with_only_defaults", |
| 2677 |
.kwtuple = KWTUPLE, |
| 2678 |
}; |
| 2679 |
#undef KWTUPLE |
| 2680 |
PyObject *argsbuf[2]; |
| 2681 |
Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 2682 |
PyObject *__clinic_args = NULL; |
| 2683 |
PyObject *b = Py_None; |
| 2684 |
|
| 2685 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, 0, argsbuf); |
| 2686 |
if (!args) { |
| 2687 |
goto exit; |
| 2688 |
} |
| 2689 |
__clinic_args = args[0]; |
| 2690 |
if (!noptargs) { |
| 2691 |
goto skip_optional_kwonly; |
| 2692 |
} |
| 2693 |
b = args[1]; |
| 2694 |
skip_optional_kwonly: |
| 2695 |
return_value = vararg_with_only_defaults_impl(module, __clinic_args, b); |
| 2696 |
|
| 2697 |
exit: |
| 2698 |
Py_XDECREF(__clinic_args); |
| 2699 |
return return_value; |
| 2700 |
} |
| 2701 |
|
| 2702 |
PyDoc_STRVAR(vararg_kwonly_req_opt__doc__, |
| 2703 |
"vararg_kwonly_req_opt($module, /, *args, a, b=None, c=None)\n" |
| 2704 |
"--\n" |
| 2705 |
"\n"); |
| 2706 |
|
| 2707 |
#define VARARG_KWONLY_REQ_OPT_METHODDEF \ |
| 2708 |
{"vararg_kwonly_req_opt", _PyCFunction_CAST(vararg_kwonly_req_opt), METH_FASTCALL|METH_KEYWORDS, vararg_kwonly_req_opt__doc__}, |
| 2709 |
|
| 2710 |
static PyObject * |
| 2711 |
vararg_kwonly_req_opt_impl(PyObject *module, PyObject *args, PyObject *a, |
| 2712 |
PyObject *b, PyObject *c); |
| 2713 |
|
| 2714 |
static PyObject * |
| 2715 |
vararg_kwonly_req_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2716 |
{ |
| 2717 |
PyObject *return_value = NULL; |
| 2718 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2719 |
|
| 2720 |
#define NUM_KEYWORDS 3 |
| 2721 |
static struct { |
| 2722 |
PyGC_Head _this_is_not_used; |
| 2723 |
PyObject_VAR_HEAD |
| 2724 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2725 |
} _kwtuple = { |
| 2726 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2727 |
.ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), }, |
| 2728 |
}; |
| 2729 |
#undef NUM_KEYWORDS |
| 2730 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2731 |
|
| 2732 |
#else // !Py_BUILD_CORE |
| 2733 |
# define KWTUPLE NULL |
| 2734 |
#endif // !Py_BUILD_CORE |
| 2735 |
|
| 2736 |
static const char * const _keywords[] = {"a", "b", "c", NULL}; |
| 2737 |
static _PyArg_Parser _parser = { |
| 2738 |
.keywords = _keywords, |
| 2739 |
.fname = "vararg_kwonly_req_opt", |
| 2740 |
.kwtuple = KWTUPLE, |
| 2741 |
}; |
| 2742 |
#undef KWTUPLE |
| 2743 |
PyObject *argsbuf[4]; |
| 2744 |
Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2745 |
PyObject *__clinic_args = NULL; |
| 2746 |
PyObject *a; |
| 2747 |
PyObject *b = Py_None; |
| 2748 |
PyObject *c = Py_None; |
| 2749 |
|
| 2750 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 0, 0, 1, 0, argsbuf); |
| 2751 |
if (!args) { |
| 2752 |
goto exit; |
| 2753 |
} |
| 2754 |
__clinic_args = args[0]; |
| 2755 |
a = args[1]; |
| 2756 |
if (!noptargs) { |
| 2757 |
goto skip_optional_kwonly; |
| 2758 |
} |
| 2759 |
if (args[2]) { |
| 2760 |
b = args[2]; |
| 2761 |
if (!--noptargs) { |
| 2762 |
goto skip_optional_kwonly; |
| 2763 |
} |
| 2764 |
} |
| 2765 |
c = args[3]; |
| 2766 |
skip_optional_kwonly: |
| 2767 |
return_value = vararg_kwonly_req_opt_impl(module, __clinic_args, a, b, c); |
| 2768 |
|
| 2769 |
exit: |
| 2770 |
Py_XDECREF(__clinic_args); |
| 2771 |
return return_value; |
| 2772 |
} |
| 2773 |
|
| 2774 |
PyDoc_STRVAR(gh_32092_oob__doc__, |
| 2775 |
"gh_32092_oob($module, /, pos1, pos2, *varargs, kw1=None, kw2=None)\n" |
| 2776 |
"--\n" |
| 2777 |
"\n" |
| 2778 |
"Proof-of-concept of GH-32092 OOB bug."); |
| 2779 |
|
| 2780 |
#define GH_32092_OOB_METHODDEF \ |
| 2781 |
{"gh_32092_oob", _PyCFunction_CAST(gh_32092_oob), METH_FASTCALL|METH_KEYWORDS, gh_32092_oob__doc__}, |
| 2782 |
|
| 2783 |
static PyObject * |
| 2784 |
gh_32092_oob_impl(PyObject *module, PyObject *pos1, PyObject *pos2, |
| 2785 |
PyObject *varargs, PyObject *kw1, PyObject *kw2); |
| 2786 |
|
| 2787 |
static PyObject * |
| 2788 |
gh_32092_oob(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2789 |
{ |
| 2790 |
PyObject *return_value = NULL; |
| 2791 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2792 |
|
| 2793 |
#define NUM_KEYWORDS 4 |
| 2794 |
static struct { |
| 2795 |
PyGC_Head _this_is_not_used; |
| 2796 |
PyObject_VAR_HEAD |
| 2797 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2798 |
} _kwtuple = { |
| 2799 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2800 |
.ob_item = { &_Py_ID(pos1), &_Py_ID(pos2), &_Py_ID(kw1), &_Py_ID(kw2), }, |
| 2801 |
}; |
| 2802 |
#undef NUM_KEYWORDS |
| 2803 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2804 |
|
| 2805 |
#else // !Py_BUILD_CORE |
| 2806 |
# define KWTUPLE NULL |
| 2807 |
#endif // !Py_BUILD_CORE |
| 2808 |
|
| 2809 |
static const char * const _keywords[] = {"pos1", "pos2", "kw1", "kw2", NULL}; |
| 2810 |
static _PyArg_Parser _parser = { |
| 2811 |
.keywords = _keywords, |
| 2812 |
.fname = "gh_32092_oob", |
| 2813 |
.kwtuple = KWTUPLE, |
| 2814 |
}; |
| 2815 |
#undef KWTUPLE |
| 2816 |
PyObject *argsbuf[5]; |
| 2817 |
Py_ssize_t noptargs = Py_MIN(nargs, 2) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; |
| 2818 |
PyObject *pos1; |
| 2819 |
PyObject *pos2; |
| 2820 |
PyObject *varargs = NULL; |
| 2821 |
PyObject *kw1 = Py_None; |
| 2822 |
PyObject *kw2 = Py_None; |
| 2823 |
|
| 2824 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, 2, argsbuf); |
| 2825 |
if (!args) { |
| 2826 |
goto exit; |
| 2827 |
} |
| 2828 |
pos1 = args[0]; |
| 2829 |
pos2 = args[1]; |
| 2830 |
varargs = args[2]; |
| 2831 |
if (!noptargs) { |
| 2832 |
goto skip_optional_kwonly; |
| 2833 |
} |
| 2834 |
if (args[3]) { |
| 2835 |
kw1 = args[3]; |
| 2836 |
if (!--noptargs) { |
| 2837 |
goto skip_optional_kwonly; |
| 2838 |
} |
| 2839 |
} |
| 2840 |
kw2 = args[4]; |
| 2841 |
skip_optional_kwonly: |
| 2842 |
return_value = gh_32092_oob_impl(module, pos1, pos2, varargs, kw1, kw2); |
| 2843 |
|
| 2844 |
exit: |
| 2845 |
Py_XDECREF(varargs); |
| 2846 |
return return_value; |
| 2847 |
} |
| 2848 |
|
| 2849 |
PyDoc_STRVAR(gh_32092_kw_pass__doc__, |
| 2850 |
"gh_32092_kw_pass($module, /, pos, *args, kw=None)\n" |
| 2851 |
"--\n" |
| 2852 |
"\n" |
| 2853 |
"Proof-of-concept of GH-32092 keyword args passing bug."); |
| 2854 |
|
| 2855 |
#define GH_32092_KW_PASS_METHODDEF \ |
| 2856 |
{"gh_32092_kw_pass", _PyCFunction_CAST(gh_32092_kw_pass), METH_FASTCALL|METH_KEYWORDS, gh_32092_kw_pass__doc__}, |
| 2857 |
|
| 2858 |
static PyObject * |
| 2859 |
gh_32092_kw_pass_impl(PyObject *module, PyObject *pos, PyObject *args, |
| 2860 |
PyObject *kw); |
| 2861 |
|
| 2862 |
static PyObject * |
| 2863 |
gh_32092_kw_pass(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2864 |
{ |
| 2865 |
PyObject *return_value = NULL; |
| 2866 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 2867 |
|
| 2868 |
#define NUM_KEYWORDS 2 |
| 2869 |
static struct { |
| 2870 |
PyGC_Head _this_is_not_used; |
| 2871 |
PyObject_VAR_HEAD |
| 2872 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 2873 |
} _kwtuple = { |
| 2874 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 2875 |
.ob_item = { &_Py_ID(pos), &_Py_ID(kw), }, |
| 2876 |
}; |
| 2877 |
#undef NUM_KEYWORDS |
| 2878 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 2879 |
|
| 2880 |
#else // !Py_BUILD_CORE |
| 2881 |
# define KWTUPLE NULL |
| 2882 |
#endif // !Py_BUILD_CORE |
| 2883 |
|
| 2884 |
static const char * const _keywords[] = {"pos", "kw", NULL}; |
| 2885 |
static _PyArg_Parser _parser = { |
| 2886 |
.keywords = _keywords, |
| 2887 |
.fname = "gh_32092_kw_pass", |
| 2888 |
.kwtuple = KWTUPLE, |
| 2889 |
}; |
| 2890 |
#undef KWTUPLE |
| 2891 |
PyObject *argsbuf[3]; |
| 2892 |
Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 2893 |
PyObject *pos; |
| 2894 |
PyObject *__clinic_args = NULL; |
| 2895 |
PyObject *kw = Py_None; |
| 2896 |
|
| 2897 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf); |
| 2898 |
if (!args) { |
| 2899 |
goto exit; |
| 2900 |
} |
| 2901 |
pos = args[0]; |
| 2902 |
__clinic_args = args[1]; |
| 2903 |
if (!noptargs) { |
| 2904 |
goto skip_optional_kwonly; |
| 2905 |
} |
| 2906 |
kw = args[2]; |
| 2907 |
skip_optional_kwonly: |
| 2908 |
return_value = gh_32092_kw_pass_impl(module, pos, __clinic_args, kw); |
| 2909 |
|
| 2910 |
exit: |
| 2911 |
Py_XDECREF(__clinic_args); |
| 2912 |
return return_value; |
| 2913 |
} |
| 2914 |
|
| 2915 |
PyDoc_STRVAR(gh_99233_refcount__doc__, |
| 2916 |
"gh_99233_refcount($module, /, *args)\n" |
| 2917 |
"--\n" |
| 2918 |
"\n" |
| 2919 |
"Proof-of-concept of GH-99233 refcount error bug."); |
| 2920 |
|
| 2921 |
#define GH_99233_REFCOUNT_METHODDEF \ |
| 2922 |
{"gh_99233_refcount", _PyCFunction_CAST(gh_99233_refcount), METH_FASTCALL, gh_99233_refcount__doc__}, |
| 2923 |
|
| 2924 |
static PyObject * |
| 2925 |
gh_99233_refcount_impl(PyObject *module, PyObject *args); |
| 2926 |
|
| 2927 |
static PyObject * |
| 2928 |
gh_99233_refcount(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 2929 |
{ |
| 2930 |
PyObject *return_value = NULL; |
| 2931 |
PyObject *__clinic_args = NULL; |
| 2932 |
|
| 2933 |
if (!_PyArg_CheckPositional("gh_99233_refcount", nargs, 0, PY_SSIZE_T_MAX)) { |
| 2934 |
goto exit; |
| 2935 |
} |
| 2936 |
__clinic_args = PyTuple_New(nargs - 0); |
| 2937 |
if (!__clinic_args) { |
| 2938 |
goto exit; |
| 2939 |
} |
| 2940 |
for (Py_ssize_t i = 0; i < nargs - 0; ++i) { |
| 2941 |
PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[0 + i])); |
| 2942 |
} |
| 2943 |
return_value = gh_99233_refcount_impl(module, __clinic_args); |
| 2944 |
|
| 2945 |
exit: |
| 2946 |
Py_XDECREF(__clinic_args); |
| 2947 |
return return_value; |
| 2948 |
} |
| 2949 |
|
| 2950 |
PyDoc_STRVAR(gh_99240_double_free__doc__, |
| 2951 |
"gh_99240_double_free($module, a, b, /)\n" |
| 2952 |
"--\n" |
| 2953 |
"\n" |
| 2954 |
"Proof-of-concept of GH-99240 double-free bug."); |
| 2955 |
|
| 2956 |
#define GH_99240_DOUBLE_FREE_METHODDEF \ |
| 2957 |
{"gh_99240_double_free", _PyCFunction_CAST(gh_99240_double_free), METH_FASTCALL, gh_99240_double_free__doc__}, |
| 2958 |
|
| 2959 |
static PyObject * |
| 2960 |
gh_99240_double_free_impl(PyObject *module, char *a, char *b); |
| 2961 |
|
| 2962 |
static PyObject * |
| 2963 |
gh_99240_double_free(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 2964 |
{ |
| 2965 |
PyObject *return_value = NULL; |
| 2966 |
char *a = NULL; |
| 2967 |
char *b = NULL; |
| 2968 |
|
| 2969 |
if (!_PyArg_ParseStack(args, nargs, "eses:gh_99240_double_free", |
| 2970 |
"idna", &a, "idna", &b)) { |
| 2971 |
goto exit; |
| 2972 |
} |
| 2973 |
return_value = gh_99240_double_free_impl(module, a, b); |
| 2974 |
/* Post parse cleanup for a */ |
| 2975 |
PyMem_FREE(a); |
| 2976 |
/* Post parse cleanup for b */ |
| 2977 |
PyMem_FREE(b); |
| 2978 |
|
| 2979 |
exit: |
| 2980 |
return return_value; |
| 2981 |
} |
| 2982 |
|
| 2983 |
PyDoc_STRVAR(null_or_tuple_for_varargs__doc__, |
| 2984 |
"null_or_tuple_for_varargs($module, /, name, *constraints,\n" |
| 2985 |
" covariant=False)\n" |
| 2986 |
"--\n" |
| 2987 |
"\n" |
| 2988 |
"See https://github.com/python/cpython/issues/110864"); |
| 2989 |
|
| 2990 |
#define NULL_OR_TUPLE_FOR_VARARGS_METHODDEF \ |
| 2991 |
{"null_or_tuple_for_varargs", _PyCFunction_CAST(null_or_tuple_for_varargs), METH_FASTCALL|METH_KEYWORDS, null_or_tuple_for_varargs__doc__}, |
| 2992 |
|
| 2993 |
static PyObject * |
| 2994 |
null_or_tuple_for_varargs_impl(PyObject *module, PyObject *name, |
| 2995 |
PyObject *constraints, int covariant); |
| 2996 |
|
| 2997 |
static PyObject * |
| 2998 |
null_or_tuple_for_varargs(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 2999 |
{ |
| 3000 |
PyObject *return_value = NULL; |
| 3001 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3002 |
|
| 3003 |
#define NUM_KEYWORDS 2 |
| 3004 |
static struct { |
| 3005 |
PyGC_Head _this_is_not_used; |
| 3006 |
PyObject_VAR_HEAD |
| 3007 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3008 |
} _kwtuple = { |
| 3009 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3010 |
.ob_item = { &_Py_ID(name), &_Py_ID(covariant), }, |
| 3011 |
}; |
| 3012 |
#undef NUM_KEYWORDS |
| 3013 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3014 |
|
| 3015 |
#else // !Py_BUILD_CORE |
| 3016 |
# define KWTUPLE NULL |
| 3017 |
#endif // !Py_BUILD_CORE |
| 3018 |
|
| 3019 |
static const char * const _keywords[] = {"name", "covariant", NULL}; |
| 3020 |
static _PyArg_Parser _parser = { |
| 3021 |
.keywords = _keywords, |
| 3022 |
.fname = "null_or_tuple_for_varargs", |
| 3023 |
.kwtuple = KWTUPLE, |
| 3024 |
}; |
| 3025 |
#undef KWTUPLE |
| 3026 |
PyObject *argsbuf[3]; |
| 3027 |
Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
| 3028 |
PyObject *name; |
| 3029 |
PyObject *constraints = NULL; |
| 3030 |
int covariant = 0; |
| 3031 |
|
| 3032 |
args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf); |
| 3033 |
if (!args) { |
| 3034 |
goto exit; |
| 3035 |
} |
| 3036 |
name = args[0]; |
| 3037 |
constraints = args[1]; |
| 3038 |
if (!noptargs) { |
| 3039 |
goto skip_optional_kwonly; |
| 3040 |
} |
| 3041 |
covariant = PyObject_IsTrue(args[2]); |
| 3042 |
if (covariant < 0) { |
| 3043 |
goto exit; |
| 3044 |
} |
| 3045 |
skip_optional_kwonly: |
| 3046 |
return_value = null_or_tuple_for_varargs_impl(module, name, constraints, covariant); |
| 3047 |
|
| 3048 |
exit: |
| 3049 |
Py_XDECREF(constraints); |
| 3050 |
return return_value; |
| 3051 |
} |
| 3052 |
|
| 3053 |
PyDoc_STRVAR(clone_f1__doc__, |
| 3054 |
"clone_f1($module, /, path)\n" |
| 3055 |
"--\n" |
| 3056 |
"\n"); |
| 3057 |
|
| 3058 |
#define CLONE_F1_METHODDEF \ |
| 3059 |
{"clone_f1", _PyCFunction_CAST(clone_f1), METH_FASTCALL|METH_KEYWORDS, clone_f1__doc__}, |
| 3060 |
|
| 3061 |
static PyObject * |
| 3062 |
clone_f1_impl(PyObject *module, const char *path); |
| 3063 |
|
| 3064 |
static PyObject * |
| 3065 |
clone_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3066 |
{ |
| 3067 |
PyObject *return_value = NULL; |
| 3068 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3069 |
|
| 3070 |
#define NUM_KEYWORDS 1 |
| 3071 |
static struct { |
| 3072 |
PyGC_Head _this_is_not_used; |
| 3073 |
PyObject_VAR_HEAD |
| 3074 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3075 |
} _kwtuple = { |
| 3076 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3077 |
.ob_item = { &_Py_ID(path), }, |
| 3078 |
}; |
| 3079 |
#undef NUM_KEYWORDS |
| 3080 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3081 |
|
| 3082 |
#else // !Py_BUILD_CORE |
| 3083 |
# define KWTUPLE NULL |
| 3084 |
#endif // !Py_BUILD_CORE |
| 3085 |
|
| 3086 |
static const char * const _keywords[] = {"path", NULL}; |
| 3087 |
static _PyArg_Parser _parser = { |
| 3088 |
.keywords = _keywords, |
| 3089 |
.fname = "clone_f1", |
| 3090 |
.kwtuple = KWTUPLE, |
| 3091 |
}; |
| 3092 |
#undef KWTUPLE |
| 3093 |
PyObject *argsbuf[1]; |
| 3094 |
const char *path; |
| 3095 |
|
| 3096 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
| 3097 |
if (!args) { |
| 3098 |
goto exit; |
| 3099 |
} |
| 3100 |
if (!PyUnicode_Check(args[0])) { |
| 3101 |
_PyArg_BadArgument("clone_f1", "argument 'path'", "str", args[0]); |
| 3102 |
goto exit; |
| 3103 |
} |
| 3104 |
Py_ssize_t path_length; |
| 3105 |
path = PyUnicode_AsUTF8AndSize(args[0], &path_length); |
| 3106 |
if (path == NULL) { |
| 3107 |
goto exit; |
| 3108 |
} |
| 3109 |
if (strlen(path) != (size_t)path_length) { |
| 3110 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 3111 |
goto exit; |
| 3112 |
} |
| 3113 |
return_value = clone_f1_impl(module, path); |
| 3114 |
|
| 3115 |
exit: |
| 3116 |
return return_value; |
| 3117 |
} |
| 3118 |
|
| 3119 |
PyDoc_STRVAR(clone_f2__doc__, |
| 3120 |
"clone_f2($module, /, path)\n" |
| 3121 |
"--\n" |
| 3122 |
"\n"); |
| 3123 |
|
| 3124 |
#define CLONE_F2_METHODDEF \ |
| 3125 |
{"clone_f2", _PyCFunction_CAST(clone_f2), METH_FASTCALL|METH_KEYWORDS, clone_f2__doc__}, |
| 3126 |
|
| 3127 |
static PyObject * |
| 3128 |
clone_f2_impl(PyObject *module, const char *path); |
| 3129 |
|
| 3130 |
static PyObject * |
| 3131 |
clone_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3132 |
{ |
| 3133 |
PyObject *return_value = NULL; |
| 3134 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3135 |
|
| 3136 |
#define NUM_KEYWORDS 1 |
| 3137 |
static struct { |
| 3138 |
PyGC_Head _this_is_not_used; |
| 3139 |
PyObject_VAR_HEAD |
| 3140 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3141 |
} _kwtuple = { |
| 3142 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3143 |
.ob_item = { &_Py_ID(path), }, |
| 3144 |
}; |
| 3145 |
#undef NUM_KEYWORDS |
| 3146 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3147 |
|
| 3148 |
#else // !Py_BUILD_CORE |
| 3149 |
# define KWTUPLE NULL |
| 3150 |
#endif // !Py_BUILD_CORE |
| 3151 |
|
| 3152 |
static const char * const _keywords[] = {"path", NULL}; |
| 3153 |
static _PyArg_Parser _parser = { |
| 3154 |
.keywords = _keywords, |
| 3155 |
.fname = "clone_f2", |
| 3156 |
.kwtuple = KWTUPLE, |
| 3157 |
}; |
| 3158 |
#undef KWTUPLE |
| 3159 |
PyObject *argsbuf[1]; |
| 3160 |
const char *path; |
| 3161 |
|
| 3162 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
| 3163 |
if (!args) { |
| 3164 |
goto exit; |
| 3165 |
} |
| 3166 |
if (!PyUnicode_Check(args[0])) { |
| 3167 |
_PyArg_BadArgument("clone_f2", "argument 'path'", "str", args[0]); |
| 3168 |
goto exit; |
| 3169 |
} |
| 3170 |
Py_ssize_t path_length; |
| 3171 |
path = PyUnicode_AsUTF8AndSize(args[0], &path_length); |
| 3172 |
if (path == NULL) { |
| 3173 |
goto exit; |
| 3174 |
} |
| 3175 |
if (strlen(path) != (size_t)path_length) { |
| 3176 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 3177 |
goto exit; |
| 3178 |
} |
| 3179 |
return_value = clone_f2_impl(module, path); |
| 3180 |
|
| 3181 |
exit: |
| 3182 |
return return_value; |
| 3183 |
} |
| 3184 |
|
| 3185 |
PyDoc_STRVAR(clone_with_conv_f1__doc__, |
| 3186 |
"clone_with_conv_f1($module, /, path=None)\n" |
| 3187 |
"--\n" |
| 3188 |
"\n"); |
| 3189 |
|
| 3190 |
#define CLONE_WITH_CONV_F1_METHODDEF \ |
| 3191 |
{"clone_with_conv_f1", _PyCFunction_CAST(clone_with_conv_f1), METH_FASTCALL|METH_KEYWORDS, clone_with_conv_f1__doc__}, |
| 3192 |
|
| 3193 |
static PyObject * |
| 3194 |
clone_with_conv_f1_impl(PyObject *module, custom_t path); |
| 3195 |
|
| 3196 |
static PyObject * |
| 3197 |
clone_with_conv_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3198 |
{ |
| 3199 |
PyObject *return_value = NULL; |
| 3200 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3201 |
|
| 3202 |
#define NUM_KEYWORDS 1 |
| 3203 |
static struct { |
| 3204 |
PyGC_Head _this_is_not_used; |
| 3205 |
PyObject_VAR_HEAD |
| 3206 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3207 |
} _kwtuple = { |
| 3208 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3209 |
.ob_item = { &_Py_ID(path), }, |
| 3210 |
}; |
| 3211 |
#undef NUM_KEYWORDS |
| 3212 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3213 |
|
| 3214 |
#else // !Py_BUILD_CORE |
| 3215 |
# define KWTUPLE NULL |
| 3216 |
#endif // !Py_BUILD_CORE |
| 3217 |
|
| 3218 |
static const char * const _keywords[] = {"path", NULL}; |
| 3219 |
static _PyArg_Parser _parser = { |
| 3220 |
.keywords = _keywords, |
| 3221 |
.fname = "clone_with_conv_f1", |
| 3222 |
.kwtuple = KWTUPLE, |
| 3223 |
}; |
| 3224 |
#undef KWTUPLE |
| 3225 |
PyObject *argsbuf[1]; |
| 3226 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 3227 |
custom_t path = { |
| 3228 |
.name = "clone_with_conv_f1", |
| 3229 |
}; |
| 3230 |
|
| 3231 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); |
| 3232 |
if (!args) { |
| 3233 |
goto exit; |
| 3234 |
} |
| 3235 |
if (!noptargs) { |
| 3236 |
goto skip_optional_pos; |
| 3237 |
} |
| 3238 |
if (!custom_converter(args[0], &path)) { |
| 3239 |
goto exit; |
| 3240 |
} |
| 3241 |
skip_optional_pos: |
| 3242 |
return_value = clone_with_conv_f1_impl(module, path); |
| 3243 |
|
| 3244 |
exit: |
| 3245 |
return return_value; |
| 3246 |
} |
| 3247 |
|
| 3248 |
PyDoc_STRVAR(clone_with_conv_f2__doc__, |
| 3249 |
"clone_with_conv_f2($module, /, path=None)\n" |
| 3250 |
"--\n" |
| 3251 |
"\n"); |
| 3252 |
|
| 3253 |
#define CLONE_WITH_CONV_F2_METHODDEF \ |
| 3254 |
{"clone_with_conv_f2", _PyCFunction_CAST(clone_with_conv_f2), METH_FASTCALL|METH_KEYWORDS, clone_with_conv_f2__doc__}, |
| 3255 |
|
| 3256 |
static PyObject * |
| 3257 |
clone_with_conv_f2_impl(PyObject *module, custom_t path); |
| 3258 |
|
| 3259 |
static PyObject * |
| 3260 |
clone_with_conv_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3261 |
{ |
| 3262 |
PyObject *return_value = NULL; |
| 3263 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3264 |
|
| 3265 |
#define NUM_KEYWORDS 1 |
| 3266 |
static struct { |
| 3267 |
PyGC_Head _this_is_not_used; |
| 3268 |
PyObject_VAR_HEAD |
| 3269 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3270 |
} _kwtuple = { |
| 3271 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3272 |
.ob_item = { &_Py_ID(path), }, |
| 3273 |
}; |
| 3274 |
#undef NUM_KEYWORDS |
| 3275 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3276 |
|
| 3277 |
#else // !Py_BUILD_CORE |
| 3278 |
# define KWTUPLE NULL |
| 3279 |
#endif // !Py_BUILD_CORE |
| 3280 |
|
| 3281 |
static const char * const _keywords[] = {"path", NULL}; |
| 3282 |
static _PyArg_Parser _parser = { |
| 3283 |
.keywords = _keywords, |
| 3284 |
.fname = "clone_with_conv_f2", |
| 3285 |
.kwtuple = KWTUPLE, |
| 3286 |
}; |
| 3287 |
#undef KWTUPLE |
| 3288 |
PyObject *argsbuf[1]; |
| 3289 |
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
| 3290 |
custom_t path = { |
| 3291 |
.name = "clone_with_conv_f2", |
| 3292 |
}; |
| 3293 |
|
| 3294 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); |
| 3295 |
if (!args) { |
| 3296 |
goto exit; |
| 3297 |
} |
| 3298 |
if (!noptargs) { |
| 3299 |
goto skip_optional_pos; |
| 3300 |
} |
| 3301 |
if (!custom_converter(args[0], &path)) { |
| 3302 |
goto exit; |
| 3303 |
} |
| 3304 |
skip_optional_pos: |
| 3305 |
return_value = clone_with_conv_f2_impl(module, path); |
| 3306 |
|
| 3307 |
exit: |
| 3308 |
return return_value; |
| 3309 |
} |
| 3310 |
|
| 3311 |
PyDoc_STRVAR(_testclinic_TestClass_get_defining_class__doc__, |
| 3312 |
"get_defining_class($self, /)\n" |
| 3313 |
"--\n" |
| 3314 |
"\n"); |
| 3315 |
|
| 3316 |
#define _TESTCLINIC_TESTCLASS_GET_DEFINING_CLASS_METHODDEF \ |
| 3317 |
{"get_defining_class", _PyCFunction_CAST(_testclinic_TestClass_get_defining_class), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testclinic_TestClass_get_defining_class__doc__}, |
| 3318 |
|
| 3319 |
static PyObject * |
| 3320 |
_testclinic_TestClass_get_defining_class_impl(PyObject *self, |
| 3321 |
PyTypeObject *cls); |
| 3322 |
|
| 3323 |
static PyObject * |
| 3324 |
_testclinic_TestClass_get_defining_class(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3325 |
{ |
| 3326 |
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
| 3327 |
PyErr_SetString(PyExc_TypeError, "get_defining_class() takes no arguments"); |
| 3328 |
return NULL; |
| 3329 |
} |
| 3330 |
return _testclinic_TestClass_get_defining_class_impl(self, cls); |
| 3331 |
} |
| 3332 |
|
| 3333 |
PyDoc_STRVAR(_testclinic_TestClass_get_defining_class_arg__doc__, |
| 3334 |
"get_defining_class_arg($self, /, arg)\n" |
| 3335 |
"--\n" |
| 3336 |
"\n"); |
| 3337 |
|
| 3338 |
#define _TESTCLINIC_TESTCLASS_GET_DEFINING_CLASS_ARG_METHODDEF \ |
| 3339 |
{"get_defining_class_arg", _PyCFunction_CAST(_testclinic_TestClass_get_defining_class_arg), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testclinic_TestClass_get_defining_class_arg__doc__}, |
| 3340 |
|
| 3341 |
static PyObject * |
| 3342 |
_testclinic_TestClass_get_defining_class_arg_impl(PyObject *self, |
| 3343 |
PyTypeObject *cls, |
| 3344 |
PyObject *arg); |
| 3345 |
|
| 3346 |
static PyObject * |
| 3347 |
_testclinic_TestClass_get_defining_class_arg(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 3348 |
{ |
| 3349 |
PyObject *return_value = NULL; |
| 3350 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 3351 |
|
| 3352 |
#define NUM_KEYWORDS 1 |
| 3353 |
static struct { |
| 3354 |
PyGC_Head _this_is_not_used; |
| 3355 |
PyObject_VAR_HEAD |
| 3356 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 3357 |
} _kwtuple = { |
| 3358 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 3359 |
.ob_item = { &_Py_ID(arg), }, |
| 3360 |
}; |
| 3361 |
#undef NUM_KEYWORDS |
| 3362 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 3363 |
|
| 3364 |
#else // !Py_BUILD_CORE |
| 3365 |
# define KWTUPLE NULL |
| 3366 |
#endif // !Py_BUILD_CORE |
| 3367 |
|
| 3368 |
static const char * const _keywords[] = {"arg", NULL}; |
| 3369 |
static _PyArg_Parser _parser = { |
| 3370 |
.keywords = _keywords, |
| 3371 |
.fname = "get_defining_class_arg", |
| 3372 |
.kwtuple = KWTUPLE, |
| 3373 |
}; |
| 3374 |
#undef KWTUPLE |
| 3375 |
PyObject *argsbuf[1]; |
| 3376 |
PyObject *arg; |
| 3377 |
|
| 3378 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
| 3379 |
if (!args) { |
| 3380 |
goto exit; |
| 3381 |
} |
| 3382 |
arg = args[0]; |
| 3383 |
return_value = _testclinic_TestClass_get_defining_class_arg_impl(self, cls, arg); |
| 3384 |
|
| 3385 |
exit: |
| 3386 |
return return_value; |
| 3387 |
} |
| 3388 |
/*[clinic end generated code: output=c556818496a3ec72 input=a9049054013a1b77]*/ |