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