Debian Codegraph @

Python/clinic/bltinmodule.c.h

raw
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6 # include "pycore_gc.h" // PyGC_Head
7 # include "pycore_runtime.h" // _Py_ID()
8 #endif
9 #include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
10
11 PyDoc_STRVAR(builtin___import____doc__,
12 "__import__($module, /, name, globals=None, locals=None, fromlist=(),\n"
13 " level=0)\n"
14 "--\n"
15 "\n"
16 "Import a module.\n"
17 "\n"
18 "Because this function is meant for use by the Python\n"
19 "interpreter and not for general use, it is better to use\n"
20 "importlib.import_module() to programmatically import a module.\n"
21 "\n"
22 "The globals argument is only used to determine the context;\n"
23 "they are not modified. The locals argument is unused. The fromlist\n"
24 "should be a list of names to emulate ``from name import ...``, or an\n"
25 "empty list to emulate ``import name``.\n"
26 "When importing a module from a package, note that __import__(\'A.B\', ...)\n"
27 "returns package A when fromlist is empty, but its submodule B when\n"
28 "fromlist is not empty. The level argument is used to determine whether to\n"
29 "perform absolute or relative imports: 0 is absolute, while a positive number\n"
30 "is the number of parent directories to search relative to the current module.");
31
32 #define BUILTIN___IMPORT___METHODDEF \
33 {"__import__", _PyCFunction_CAST(builtin___import__), METH_FASTCALL|METH_KEYWORDS, builtin___import____doc__},
34
35 static PyObject *
36 builtin___import___impl(PyObject *module, PyObject *name, PyObject *globals,
37 PyObject *locals, PyObject *fromlist, int level);
38
39 static PyObject *
40 builtin___import__(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
41 {
42 PyObject *return_value = NULL;
43 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
44
45 #define NUM_KEYWORDS 5
46 static struct {
47 PyGC_Head _this_is_not_used;
48 PyObject_VAR_HEAD
49 Py_hash_t ob_hash;
50 PyObject *ob_item[NUM_KEYWORDS];
51 } _kwtuple = {
52 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
53 .ob_hash = -1,
54 .ob_item = { &_Py_ID(name), &_Py_ID(globals), &_Py_ID(locals), &_Py_ID(fromlist), &_Py_ID(level), },
55 };
56 #undef NUM_KEYWORDS
57 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
58
59 #else // !Py_BUILD_CORE
60 # define KWTUPLE NULL
61 #endif // !Py_BUILD_CORE
62
63 static const char * const _keywords[] = {"name", "globals", "locals", "fromlist", "level", NULL};
64 static _PyArg_Parser _parser = {
65 .keywords = _keywords,
66 .fname = "__import__",
67 .kwtuple = KWTUPLE,
68 };
69 #undef KWTUPLE
70 PyObject *argsbuf[5];
71 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
72 PyObject *name;
73 PyObject *globals = NULL;
74 PyObject *locals = NULL;
75 PyObject *fromlist = NULL;
76 int level = 0;
77
78 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
79 /*minpos*/ 1, /*maxpos*/ 5, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
80 if (!args) {
81 goto exit;
82 }
83 name = args[0];
84 if (!noptargs) {
85 goto skip_optional_pos;
86 }
87 if (args[1]) {
88 globals = args[1];
89 if (!--noptargs) {
90 goto skip_optional_pos;
91 }
92 }
93 if (args[2]) {
94 locals = args[2];
95 if (!--noptargs) {
96 goto skip_optional_pos;
97 }
98 }
99 if (args[3]) {
100 fromlist = args[3];
101 if (!--noptargs) {
102 goto skip_optional_pos;
103 }
104 }
105 level = PyLong_AsInt(args[4]);
106 if (level == -1 && PyErr_Occurred()) {
107 goto exit;
108 }
109 skip_optional_pos:
110 return_value = builtin___import___impl(module, name, globals, locals, fromlist, level);
111
112 exit:
113 return return_value;
114 }
115
116 PyDoc_STRVAR(builtin_abs__doc__,
117 "abs($module, x, /)\n"
118 "--\n"
119 "\n"
120 "Return the absolute value of the argument.");
121
122 #define BUILTIN_ABS_METHODDEF \
123 {"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__},
124
125 PyDoc_STRVAR(builtin_all__doc__,
126 "all($module, iterable, /)\n"
127 "--\n"
128 "\n"
129 "Return True if bool(x) is True for all values x in the iterable.\n"
130 "\n"
131 "If the iterable is empty, return True.");
132
133 #define BUILTIN_ALL_METHODDEF \
134 {"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__},
135
136 PyDoc_STRVAR(builtin_any__doc__,
137 "any($module, iterable, /)\n"
138 "--\n"
139 "\n"
140 "Return True if bool(x) is True for any x in the iterable.\n"
141 "\n"
142 "If the iterable is empty, return False.");
143
144 #define BUILTIN_ANY_METHODDEF \
145 {"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__},
146
147 PyDoc_STRVAR(builtin_ascii__doc__,
148 "ascii($module, obj, /)\n"
149 "--\n"
150 "\n"
151 "Return an ASCII-only representation of an object.\n"
152 "\n"
153 "As repr(), return a string containing a printable representation of an\n"
154 "object, but escape the non-ASCII characters in the string returned by\n"
155 "repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n"
156 "to that returned by repr() in Python 2.");
157
158 #define BUILTIN_ASCII_METHODDEF \
159 {"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__},
160
161 PyDoc_STRVAR(builtin_bin__doc__,
162 "bin($module, number, /)\n"
163 "--\n"
164 "\n"
165 "Return the binary representation of an integer.\n"
166 "\n"
167 " >>> bin(2796202)\n"
168 " \'0b1010101010101010101010\'");
169
170 #define BUILTIN_BIN_METHODDEF \
171 {"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__},
172
173 PyDoc_STRVAR(builtin_callable__doc__,
174 "callable($module, obj, /)\n"
175 "--\n"
176 "\n"
177 "Return whether the object is callable (i.e., some kind of function).\n"
178 "\n"
179 "Note that classes are callable, as are instances of classes with a\n"
180 "__call__() method.");
181
182 #define BUILTIN_CALLABLE_METHODDEF \
183 {"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__},
184
185 PyDoc_STRVAR(builtin_format__doc__,
186 "format($module, value, format_spec=\'\', /)\n"
187 "--\n"
188 "\n"
189 "Return type(value).__format__(value, format_spec)\n"
190 "\n"
191 "Many built-in types implement format_spec according to the\n"
192 "Format Specification Mini-language. See help(\'FORMATTING\').\n"
193 "\n"
194 "If type(value) does not supply a method named __format__\n"
195 "and format_spec is empty, then str(value) is returned.\n"
196 "See also help(\'SPECIALMETHODS\').");
197
198 #define BUILTIN_FORMAT_METHODDEF \
199 {"format", _PyCFunction_CAST(builtin_format), METH_FASTCALL, builtin_format__doc__},
200
201 static PyObject *
202 builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
203
204 static PyObject *
205 builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
206 {
207 PyObject *return_value = NULL;
208 PyObject *value;
209 PyObject *format_spec = NULL;
210
211 if (!_PyArg_CheckPositional("format", nargs, 1, 2)) {
212 goto exit;
213 }
214 value = args[0];
215 if (nargs < 2) {
216 goto skip_optional;
217 }
218 if (!PyUnicode_Check(args[1])) {
219 _PyArg_BadArgument("format", "argument 2", "str", args[1]);
220 goto exit;
221 }
222 format_spec = args[1];
223 skip_optional:
224 return_value = builtin_format_impl(module, value, format_spec);
225
226 exit:
227 return return_value;
228 }
229
230 PyDoc_STRVAR(builtin_chr__doc__,
231 "chr($module, i, /)\n"
232 "--\n"
233 "\n"
234 "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
235
236 #define BUILTIN_CHR_METHODDEF \
237 {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__},
238
239 PyDoc_STRVAR(builtin_compile__doc__,
240 "compile($module, /, source, filename, mode, flags=0,\n"
241 " dont_inherit=False, optimize=-1, *, _feature_version=-1)\n"
242 "--\n"
243 "\n"
244 "Compile source into a code object that can be executed by exec() or eval().\n"
245 "\n"
246 "The source code may represent a Python module, statement or expression.\n"
247 "The filename will be used for run-time error messages.\n"
248 "The mode must be \'exec\' to compile a module, \'single\' to compile a\n"
249 "single (interactive) statement, or \'eval\' to compile an expression.\n"
250 "The flags argument, if present, controls which future statements influence\n"
251 "the compilation of the code.\n"
252 "The dont_inherit argument, if true, stops the compilation inheriting\n"
253 "the effects of any future statements in effect in the code calling\n"
254 "compile; if absent or false these statements do influence the compilation,\n"
255 "in addition to any features explicitly specified.");
256
257 #define BUILTIN_COMPILE_METHODDEF \
258 {"compile", _PyCFunction_CAST(builtin_compile), METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__},
259
260 static PyObject *
261 builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
262 const char *mode, int flags, int dont_inherit,
263 int optimize, int feature_version);
264
265 static PyObject *
266 builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
267 {
268 PyObject *return_value = NULL;
269 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
270
271 #define NUM_KEYWORDS 7
272 static struct {
273 PyGC_Head _this_is_not_used;
274 PyObject_VAR_HEAD
275 Py_hash_t ob_hash;
276 PyObject *ob_item[NUM_KEYWORDS];
277 } _kwtuple = {
278 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
279 .ob_hash = -1,
280 .ob_item = { &_Py_ID(source), &_Py_ID(filename), &_Py_ID(mode), &_Py_ID(flags), &_Py_ID(dont_inherit), &_Py_ID(optimize), &_Py_ID(_feature_version), },
281 };
282 #undef NUM_KEYWORDS
283 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
284
285 #else // !Py_BUILD_CORE
286 # define KWTUPLE NULL
287 #endif // !Py_BUILD_CORE
288
289 static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", "_feature_version", NULL};
290 static _PyArg_Parser _parser = {
291 .keywords = _keywords,
292 .fname = "compile",
293 .kwtuple = KWTUPLE,
294 };
295 #undef KWTUPLE
296 PyObject *argsbuf[7];
297 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
298 PyObject *source;
299 PyObject *filename = NULL;
300 const char *mode;
301 int flags = 0;
302 int dont_inherit = 0;
303 int optimize = -1;
304 int feature_version = -1;
305
306 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
307 /*minpos*/ 3, /*maxpos*/ 6, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
308 if (!args) {
309 goto exit;
310 }
311 source = args[0];
312 if (!PyUnicode_FSDecoder(args[1], &filename)) {
313 goto exit;
314 }
315 if (!PyUnicode_Check(args[2])) {
316 _PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]);
317 goto exit;
318 }
319 Py_ssize_t mode_length;
320 mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length);
321 if (mode == NULL) {
322 goto exit;
323 }
324 if (strlen(mode) != (size_t)mode_length) {
325 PyErr_SetString(PyExc_ValueError, "embedded null character");
326 goto exit;
327 }
328 if (!noptargs) {
329 goto skip_optional_pos;
330 }
331 if (args[3]) {
332 flags = PyLong_AsInt(args[3]);
333 if (flags == -1 && PyErr_Occurred()) {
334 goto exit;
335 }
336 if (!--noptargs) {
337 goto skip_optional_pos;
338 }
339 }
340 if (args[4]) {
341 dont_inherit = PyObject_IsTrue(args[4]);
342 if (dont_inherit < 0) {
343 goto exit;
344 }
345 if (!--noptargs) {
346 goto skip_optional_pos;
347 }
348 }
349 if (args[5]) {
350 optimize = PyLong_AsInt(args[5]);
351 if (optimize == -1 && PyErr_Occurred()) {
352 goto exit;
353 }
354 if (!--noptargs) {
355 goto skip_optional_pos;
356 }
357 }
358 skip_optional_pos:
359 if (!noptargs) {
360 goto skip_optional_kwonly;
361 }
362 feature_version = PyLong_AsInt(args[6]);
363 if (feature_version == -1 && PyErr_Occurred()) {
364 goto exit;
365 }
366 skip_optional_kwonly:
367 return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version);
368
369 exit:
370 /* Cleanup for filename */
371 Py_XDECREF(filename);
372
373 return return_value;
374 }
375
376 PyDoc_STRVAR(builtin_divmod__doc__,
377 "divmod($module, x, y, /)\n"
378 "--\n"
379 "\n"
380 "Return the tuple (x//y, x%y). Invariant: div*y + mod == x.");
381
382 #define BUILTIN_DIVMOD_METHODDEF \
383 {"divmod", _PyCFunction_CAST(builtin_divmod), METH_FASTCALL, builtin_divmod__doc__},
384
385 static PyObject *
386 builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
387
388 static PyObject *
389 builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
390 {
391 PyObject *return_value = NULL;
392 PyObject *x;
393 PyObject *y;
394
395 if (!_PyArg_CheckPositional("divmod", nargs, 2, 2)) {
396 goto exit;
397 }
398 x = args[0];
399 y = args[1];
400 return_value = builtin_divmod_impl(module, x, y);
401
402 exit:
403 return return_value;
404 }
405
406 PyDoc_STRVAR(builtin_eval__doc__,
407 "eval($module, source, /, globals=None, locals=None)\n"
408 "--\n"
409 "\n"
410 "Evaluate the given source in the context of globals and locals.\n"
411 "\n"
412 "The source may be a string representing a Python expression\n"
413 "or a code object as returned by compile().\n"
414 "The globals must be a dictionary and locals can be any mapping,\n"
415 "defaulting to the current globals and locals.\n"
416 "If only globals is given, locals defaults to it.");
417
418 #define BUILTIN_EVAL_METHODDEF \
419 {"eval", _PyCFunction_CAST(builtin_eval), METH_FASTCALL|METH_KEYWORDS, builtin_eval__doc__},
420
421 static PyObject *
422 builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
423 PyObject *locals);
424
425 static PyObject *
426 builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
427 {
428 PyObject *return_value = NULL;
429 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
430
431 #define NUM_KEYWORDS 2
432 static struct {
433 PyGC_Head _this_is_not_used;
434 PyObject_VAR_HEAD
435 Py_hash_t ob_hash;
436 PyObject *ob_item[NUM_KEYWORDS];
437 } _kwtuple = {
438 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
439 .ob_hash = -1,
440 .ob_item = { &_Py_ID(globals), &_Py_ID(locals), },
441 };
442 #undef NUM_KEYWORDS
443 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
444
445 #else // !Py_BUILD_CORE
446 # define KWTUPLE NULL
447 #endif // !Py_BUILD_CORE
448
449 static const char * const _keywords[] = {"", "globals", "locals", NULL};
450 static _PyArg_Parser _parser = {
451 .keywords = _keywords,
452 .fname = "eval",
453 .kwtuple = KWTUPLE,
454 };
455 #undef KWTUPLE
456 PyObject *argsbuf[3];
457 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
458 PyObject *source;
459 PyObject *globals = Py_None;
460 PyObject *locals = Py_None;
461
462 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
463 /*minpos*/ 1, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
464 if (!args) {
465 goto exit;
466 }
467 source = args[0];
468 if (!noptargs) {
469 goto skip_optional_pos;
470 }
471 if (args[1]) {
472 globals = args[1];
473 if (!--noptargs) {
474 goto skip_optional_pos;
475 }
476 }
477 locals = args[2];
478 skip_optional_pos:
479 return_value = builtin_eval_impl(module, source, globals, locals);
480
481 exit:
482 return return_value;
483 }
484
485 PyDoc_STRVAR(builtin_exec__doc__,
486 "exec($module, source, /, globals=None, locals=None, *, closure=None)\n"
487 "--\n"
488 "\n"
489 "Execute the given source in the context of globals and locals.\n"
490 "\n"
491 "The source may be a string representing one or more Python statements\n"
492 "or a code object as returned by compile().\n"
493 "The globals must be a dictionary and locals can be any mapping,\n"
494 "defaulting to the current globals and locals.\n"
495 "If only globals is given, locals defaults to it.\n"
496 "The closure must be a tuple of cellvars, and can only be used\n"
497 "when source is a code object requiring exactly that many cellvars.");
498
499 #define BUILTIN_EXEC_METHODDEF \
500 {"exec", _PyCFunction_CAST(builtin_exec), METH_FASTCALL|METH_KEYWORDS, builtin_exec__doc__},
501
502 static PyObject *
503 builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
504 PyObject *locals, PyObject *closure);
505
506 static PyObject *
507 builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
508 {
509 PyObject *return_value = NULL;
510 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
511
512 #define NUM_KEYWORDS 3
513 static struct {
514 PyGC_Head _this_is_not_used;
515 PyObject_VAR_HEAD
516 Py_hash_t ob_hash;
517 PyObject *ob_item[NUM_KEYWORDS];
518 } _kwtuple = {
519 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
520 .ob_hash = -1,
521 .ob_item = { &_Py_ID(globals), &_Py_ID(locals), &_Py_ID(closure), },
522 };
523 #undef NUM_KEYWORDS
524 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
525
526 #else // !Py_BUILD_CORE
527 # define KWTUPLE NULL
528 #endif // !Py_BUILD_CORE
529
530 static const char * const _keywords[] = {"", "globals", "locals", "closure", NULL};
531 static _PyArg_Parser _parser = {
532 .keywords = _keywords,
533 .fname = "exec",
534 .kwtuple = KWTUPLE,
535 };
536 #undef KWTUPLE
537 PyObject *argsbuf[4];
538 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
539 PyObject *source;
540 PyObject *globals = Py_None;
541 PyObject *locals = Py_None;
542 PyObject *closure = NULL;
543
544 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
545 /*minpos*/ 1, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
546 if (!args) {
547 goto exit;
548 }
549 source = args[0];
550 if (!noptargs) {
551 goto skip_optional_pos;
552 }
553 if (args[1]) {
554 globals = args[1];
555 if (!--noptargs) {
556 goto skip_optional_pos;
557 }
558 }
559 if (args[2]) {
560 locals = args[2];
561 if (!--noptargs) {
562 goto skip_optional_pos;
563 }
564 }
565 skip_optional_pos:
566 if (!noptargs) {
567 goto skip_optional_kwonly;
568 }
569 closure = args[3];
570 skip_optional_kwonly:
571 return_value = builtin_exec_impl(module, source, globals, locals, closure);
572
573 exit:
574 return return_value;
575 }
576
577 PyDoc_STRVAR(builtin_globals__doc__,
578 "globals($module, /)\n"
579 "--\n"
580 "\n"
581 "Return the dictionary containing the current scope\'s global variables.\n"
582 "\n"
583 "NOTE: Updates to this dictionary *will* affect name lookups in the current\n"
584 "global scope and vice-versa.");
585
586 #define BUILTIN_GLOBALS_METHODDEF \
587 {"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__},
588
589 static PyObject *
590 builtin_globals_impl(PyObject *module);
591
592 static PyObject *
593 builtin_globals(PyObject *module, PyObject *Py_UNUSED(ignored))
594 {
595 return builtin_globals_impl(module);
596 }
597
598 PyDoc_STRVAR(builtin_hasattr__doc__,
599 "hasattr($module, obj, name, /)\n"
600 "--\n"
601 "\n"
602 "Return whether the object has an attribute with the given name.\n"
603 "\n"
604 "This is done by calling getattr(obj, name) and catching AttributeError.");
605
606 #define BUILTIN_HASATTR_METHODDEF \
607 {"hasattr", _PyCFunction_CAST(builtin_hasattr), METH_FASTCALL, builtin_hasattr__doc__},
608
609 static PyObject *
610 builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
611
612 static PyObject *
613 builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
614 {
615 PyObject *return_value = NULL;
616 PyObject *obj;
617 PyObject *name;
618
619 if (!_PyArg_CheckPositional("hasattr", nargs, 2, 2)) {
620 goto exit;
621 }
622 obj = args[0];
623 name = args[1];
624 return_value = builtin_hasattr_impl(module, obj, name);
625
626 exit:
627 return return_value;
628 }
629
630 PyDoc_STRVAR(builtin_id__doc__,
631 "id($module, obj, /)\n"
632 "--\n"
633 "\n"
634 "Return the identity of an object.\n"
635 "\n"
636 "This is guaranteed to be unique among simultaneously existing objects.\n"
637 "(CPython uses the object\'s memory address.)");
638
639 #define BUILTIN_ID_METHODDEF \
640 {"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__},
641
642 static PyObject *
643 builtin_id_impl(PyModuleDef *self, PyObject *v);
644
645 static PyObject *
646 builtin_id(PyObject *self, PyObject *v)
647 {
648 PyObject *return_value = NULL;
649
650 return_value = builtin_id_impl((PyModuleDef *)self, v);
651
652 return return_value;
653 }
654
655 PyDoc_STRVAR(builtin_setattr__doc__,
656 "setattr($module, obj, name, value, /)\n"
657 "--\n"
658 "\n"
659 "Sets the named attribute on the given object to the specified value.\n"
660 "\n"
661 "setattr(x, \'y\', v) is equivalent to ``x.y = v``");
662
663 #define BUILTIN_SETATTR_METHODDEF \
664 {"setattr", _PyCFunction_CAST(builtin_setattr), METH_FASTCALL, builtin_setattr__doc__},
665
666 static PyObject *
667 builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name,
668 PyObject *value);
669
670 static PyObject *
671 builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
672 {
673 PyObject *return_value = NULL;
674 PyObject *obj;
675 PyObject *name;
676 PyObject *value;
677
678 if (!_PyArg_CheckPositional("setattr", nargs, 3, 3)) {
679 goto exit;
680 }
681 obj = args[0];
682 name = args[1];
683 value = args[2];
684 return_value = builtin_setattr_impl(module, obj, name, value);
685
686 exit:
687 return return_value;
688 }
689
690 PyDoc_STRVAR(builtin_delattr__doc__,
691 "delattr($module, obj, name, /)\n"
692 "--\n"
693 "\n"
694 "Deletes the named attribute from the given object.\n"
695 "\n"
696 "delattr(x, \'y\') is equivalent to ``del x.y``");
697
698 #define BUILTIN_DELATTR_METHODDEF \
699 {"delattr", _PyCFunction_CAST(builtin_delattr), METH_FASTCALL, builtin_delattr__doc__},
700
701 static PyObject *
702 builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
703
704 static PyObject *
705 builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
706 {
707 PyObject *return_value = NULL;
708 PyObject *obj;
709 PyObject *name;
710
711 if (!_PyArg_CheckPositional("delattr", nargs, 2, 2)) {
712 goto exit;
713 }
714 obj = args[0];
715 name = args[1];
716 return_value = builtin_delattr_impl(module, obj, name);
717
718 exit:
719 return return_value;
720 }
721
722 PyDoc_STRVAR(builtin_hash__doc__,
723 "hash($module, obj, /)\n"
724 "--\n"
725 "\n"
726 "Return the integer hash value for the given object.\n"
727 "\n"
728 "Two objects that compare equal must also have the same hash value, but\n"
729 "the reverse is not necessarily true. Hash values may differ between\n"
730 "Python processes. Not all objects are hashable; calling hash() on an\n"
731 "unhashable object raises TypeError.");
732
733 #define BUILTIN_HASH_METHODDEF \
734 {"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__},
735
736 PyDoc_STRVAR(builtin_hex__doc__,
737 "hex($module, number, /)\n"
738 "--\n"
739 "\n"
740 "Return the hexadecimal representation of an integer.\n"
741 "\n"
742 " >>> hex(12648430)\n"
743 " \'0xc0ffee\'");
744
745 #define BUILTIN_HEX_METHODDEF \
746 {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__},
747
748 PyDoc_STRVAR(builtin_aiter__doc__,
749 "aiter($module, async_iterable, /)\n"
750 "--\n"
751 "\n"
752 "Return an AsyncIterator for an AsyncIterable object.");
753
754 #define BUILTIN_AITER_METHODDEF \
755 {"aiter", (PyCFunction)builtin_aiter, METH_O, builtin_aiter__doc__},
756
757 PyDoc_STRVAR(builtin_anext__doc__,
758 "anext($module, aiterator, default=<unrepresentable>, /)\n"
759 "--\n"
760 "\n"
761 "Return the next item from the async iterator.\n"
762 "\n"
763 "If default is given and the async iterator is exhausted,\n"
764 "it is returned instead of raising StopAsyncIteration.");
765
766 #define BUILTIN_ANEXT_METHODDEF \
767 {"anext", _PyCFunction_CAST(builtin_anext), METH_FASTCALL, builtin_anext__doc__},
768
769 static PyObject *
770 builtin_anext_impl(PyObject *module, PyObject *aiterator,
771 PyObject *default_value);
772
773 static PyObject *
774 builtin_anext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
775 {
776 PyObject *return_value = NULL;
777 PyObject *aiterator;
778 PyObject *default_value = NULL;
779
780 if (!_PyArg_CheckPositional("anext", nargs, 1, 2)) {
781 goto exit;
782 }
783 aiterator = args[0];
784 if (nargs < 2) {
785 goto skip_optional;
786 }
787 default_value = args[1];
788 skip_optional:
789 return_value = builtin_anext_impl(module, aiterator, default_value);
790
791 exit:
792 return return_value;
793 }
794
795 PyDoc_STRVAR(builtin_len__doc__,
796 "len($module, obj, /)\n"
797 "--\n"
798 "\n"
799 "Return the number of items in a container.");
800
801 #define BUILTIN_LEN_METHODDEF \
802 {"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__},
803
804 PyDoc_STRVAR(builtin_locals__doc__,
805 "locals($module, /)\n"
806 "--\n"
807 "\n"
808 "Return a dictionary containing the current scope\'s local variables.\n"
809 "\n"
810 "NOTE: Whether or not updates to this dictionary will affect name lookups in\n"
811 "the local scope and vice-versa is *implementation dependent* and not\n"
812 "covered by any backwards compatibility guarantees.");
813
814 #define BUILTIN_LOCALS_METHODDEF \
815 {"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__},
816
817 static PyObject *
818 builtin_locals_impl(PyObject *module);
819
820 static PyObject *
821 builtin_locals(PyObject *module, PyObject *Py_UNUSED(ignored))
822 {
823 return builtin_locals_impl(module);
824 }
825
826 PyDoc_STRVAR(builtin_oct__doc__,
827 "oct($module, number, /)\n"
828 "--\n"
829 "\n"
830 "Return the octal representation of an integer.\n"
831 "\n"
832 " >>> oct(342391)\n"
833 " \'0o1234567\'");
834
835 #define BUILTIN_OCT_METHODDEF \
836 {"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
837
838 PyDoc_STRVAR(builtin_ord__doc__,
839 "ord($module, character, /)\n"
840 "--\n"
841 "\n"
842 "Return the ordinal value of a character.\n"
843 "\n"
844 "If the argument is a one-character string, return the Unicode code\n"
845 "point of that character.\n"
846 "\n"
847 "If the argument is a bytes or bytearray object of length 1, return its\n"
848 "single byte value.");
849
850 #define BUILTIN_ORD_METHODDEF \
851 {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
852
853 PyDoc_STRVAR(builtin_pow__doc__,
854 "pow($module, /, base, exp, mod=None)\n"
855 "--\n"
856 "\n"
857 "Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments\n"
858 "\n"
859 "Some types, such as ints, are able to use a more efficient algorithm when\n"
860 "invoked using the three argument form.");
861
862 #define BUILTIN_POW_METHODDEF \
863 {"pow", _PyCFunction_CAST(builtin_pow), METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__},
864
865 static PyObject *
866 builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp,
867 PyObject *mod);
868
869 static PyObject *
870 builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
871 {
872 PyObject *return_value = NULL;
873 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
874
875 #define NUM_KEYWORDS 3
876 static struct {
877 PyGC_Head _this_is_not_used;
878 PyObject_VAR_HEAD
879 Py_hash_t ob_hash;
880 PyObject *ob_item[NUM_KEYWORDS];
881 } _kwtuple = {
882 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
883 .ob_hash = -1,
884 .ob_item = { &_Py_ID(base), &_Py_ID(exp), &_Py_ID(mod), },
885 };
886 #undef NUM_KEYWORDS
887 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
888
889 #else // !Py_BUILD_CORE
890 # define KWTUPLE NULL
891 #endif // !Py_BUILD_CORE
892
893 static const char * const _keywords[] = {"base", "exp", "mod", NULL};
894 static _PyArg_Parser _parser = {
895 .keywords = _keywords,
896 .fname = "pow",
897 .kwtuple = KWTUPLE,
898 };
899 #undef KWTUPLE
900 PyObject *argsbuf[3];
901 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
902 PyObject *base;
903 PyObject *exp;
904 PyObject *mod = Py_None;
905
906 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
907 /*minpos*/ 2, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
908 if (!args) {
909 goto exit;
910 }
911 base = args[0];
912 exp = args[1];
913 if (!noptargs) {
914 goto skip_optional_pos;
915 }
916 mod = args[2];
917 skip_optional_pos:
918 return_value = builtin_pow_impl(module, base, exp, mod);
919
920 exit:
921 return return_value;
922 }
923
924 PyDoc_STRVAR(builtin_print__doc__,
925 "print($module, /, *args, sep=\' \', end=\'\\n\', file=None, flush=False)\n"
926 "--\n"
927 "\n"
928 "Prints the values to a stream, or to sys.stdout by default.\n"
929 "\n"
930 " sep\n"
931 " string inserted between values, default a space.\n"
932 " end\n"
933 " string appended after the last value, default a newline.\n"
934 " file\n"
935 " a file-like object (stream); defaults to the current sys.stdout.\n"
936 " flush\n"
937 " whether to forcibly flush the stream.");
938
939 #define BUILTIN_PRINT_METHODDEF \
940 {"print", _PyCFunction_CAST(builtin_print), METH_FASTCALL|METH_KEYWORDS, builtin_print__doc__},
941
942 static PyObject *
943 builtin_print_impl(PyObject *module, PyObject * const *args,
944 Py_ssize_t args_length, PyObject *sep, PyObject *end,
945 PyObject *file, int flush);
946
947 static PyObject *
948 builtin_print(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
949 {
950 PyObject *return_value = NULL;
951 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
952
953 #define NUM_KEYWORDS 4
954 static struct {
955 PyGC_Head _this_is_not_used;
956 PyObject_VAR_HEAD
957 Py_hash_t ob_hash;
958 PyObject *ob_item[NUM_KEYWORDS];
959 } _kwtuple = {
960 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
961 .ob_hash = -1,
962 .ob_item = { &_Py_ID(sep), &_Py_ID(end), &_Py_ID(file), &_Py_ID(flush), },
963 };
964 #undef NUM_KEYWORDS
965 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
966
967 #else // !Py_BUILD_CORE
968 # define KWTUPLE NULL
969 #endif // !Py_BUILD_CORE
970
971 static const char * const _keywords[] = {"sep", "end", "file", "flush", NULL};
972 static _PyArg_Parser _parser = {
973 .keywords = _keywords,
974 .fname = "print",
975 .kwtuple = KWTUPLE,
976 };
977 #undef KWTUPLE
978 PyObject *argsbuf[4];
979 PyObject * const *fastargs;
980 Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
981 PyObject * const *__clinic_args;
982 Py_ssize_t args_length;
983 PyObject *sep = Py_None;
984 PyObject *end = Py_None;
985 PyObject *file = Py_None;
986 int flush = 0;
987
988 fastargs = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
989 /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 1, argsbuf);
990 if (!fastargs) {
991 goto exit;
992 }
993 if (!noptargs) {
994 goto skip_optional_kwonly;
995 }
996 if (fastargs[0]) {
997 sep = fastargs[0];
998 if (!--noptargs) {
999 goto skip_optional_kwonly;
1000 }
1001 }
1002 if (fastargs[1]) {
1003 end = fastargs[1];
1004 if (!--noptargs) {
1005 goto skip_optional_kwonly;
1006 }
1007 }
1008 if (fastargs[2]) {
1009 file = fastargs[2];
1010 if (!--noptargs) {
1011 goto skip_optional_kwonly;
1012 }
1013 }
1014 flush = PyObject_IsTrue(fastargs[3]);
1015 if (flush < 0) {
1016 goto exit;
1017 }
1018 skip_optional_kwonly:
1019 __clinic_args = args;
1020 args_length = nargs;
1021 return_value = builtin_print_impl(module, __clinic_args, args_length, sep, end, file, flush);
1022
1023 exit:
1024 return return_value;
1025 }
1026
1027 PyDoc_STRVAR(builtin_input__doc__,
1028 "input($module, prompt=\'\', /)\n"
1029 "--\n"
1030 "\n"
1031 "Read a string from standard input. The trailing newline is stripped.\n"
1032 "\n"
1033 "The prompt string, if given, is printed to standard output without a\n"
1034 "trailing newline before reading input.\n"
1035 "\n"
1036 "If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n"
1037 "On *nix systems, readline is used if available.");
1038
1039 #define BUILTIN_INPUT_METHODDEF \
1040 {"input", _PyCFunction_CAST(builtin_input), METH_FASTCALL, builtin_input__doc__},
1041
1042 static PyObject *
1043 builtin_input_impl(PyObject *module, PyObject *prompt);
1044
1045 static PyObject *
1046 builtin_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1047 {
1048 PyObject *return_value = NULL;
1049 PyObject *prompt = NULL;
1050
1051 if (!_PyArg_CheckPositional("input", nargs, 0, 1)) {
1052 goto exit;
1053 }
1054 if (nargs < 1) {
1055 goto skip_optional;
1056 }
1057 prompt = args[0];
1058 skip_optional:
1059 return_value = builtin_input_impl(module, prompt);
1060
1061 exit:
1062 return return_value;
1063 }
1064
1065 PyDoc_STRVAR(builtin_repr__doc__,
1066 "repr($module, obj, /)\n"
1067 "--\n"
1068 "\n"
1069 "Return the canonical string representation of the object.\n"
1070 "\n"
1071 "For many object types, including most builtins, eval(repr(obj)) == obj.");
1072
1073 #define BUILTIN_REPR_METHODDEF \
1074 {"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__},
1075
1076 PyDoc_STRVAR(builtin_round__doc__,
1077 "round($module, /, number, ndigits=None)\n"
1078 "--\n"
1079 "\n"
1080 "Round a number to a given precision in decimal digits.\n"
1081 "\n"
1082 "The return value is an integer if ndigits is omitted or None. Otherwise\n"
1083 "the return value has the same type as the number. ndigits may be negative.");
1084
1085 #define BUILTIN_ROUND_METHODDEF \
1086 {"round", _PyCFunction_CAST(builtin_round), METH_FASTCALL|METH_KEYWORDS, builtin_round__doc__},
1087
1088 static PyObject *
1089 builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits);
1090
1091 static PyObject *
1092 builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1093 {
1094 PyObject *return_value = NULL;
1095 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1096
1097 #define NUM_KEYWORDS 2
1098 static struct {
1099 PyGC_Head _this_is_not_used;
1100 PyObject_VAR_HEAD
1101 Py_hash_t ob_hash;
1102 PyObject *ob_item[NUM_KEYWORDS];
1103 } _kwtuple = {
1104 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1105 .ob_hash = -1,
1106 .ob_item = { &_Py_ID(number), &_Py_ID(ndigits), },
1107 };
1108 #undef NUM_KEYWORDS
1109 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1110
1111 #else // !Py_BUILD_CORE
1112 # define KWTUPLE NULL
1113 #endif // !Py_BUILD_CORE
1114
1115 static const char * const _keywords[] = {"number", "ndigits", NULL};
1116 static _PyArg_Parser _parser = {
1117 .keywords = _keywords,
1118 .fname = "round",
1119 .kwtuple = KWTUPLE,
1120 };
1121 #undef KWTUPLE
1122 PyObject *argsbuf[2];
1123 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
1124 PyObject *number;
1125 PyObject *ndigits = Py_None;
1126
1127 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1128 /*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1129 if (!args) {
1130 goto exit;
1131 }
1132 number = args[0];
1133 if (!noptargs) {
1134 goto skip_optional_pos;
1135 }
1136 ndigits = args[1];
1137 skip_optional_pos:
1138 return_value = builtin_round_impl(module, number, ndigits);
1139
1140 exit:
1141 return return_value;
1142 }
1143
1144 PyDoc_STRVAR(builtin_sum__doc__,
1145 "sum($module, iterable, /, start=0)\n"
1146 "--\n"
1147 "\n"
1148 "Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n"
1149 "\n"
1150 "When the iterable is empty, return the start value.\n"
1151 "This function is intended specifically for use with numeric values and may\n"
1152 "reject non-numeric types.");
1153
1154 #define BUILTIN_SUM_METHODDEF \
1155 {"sum", _PyCFunction_CAST(builtin_sum), METH_FASTCALL|METH_KEYWORDS, builtin_sum__doc__},
1156
1157 static PyObject *
1158 builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
1159
1160 static PyObject *
1161 builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1162 {
1163 PyObject *return_value = NULL;
1164 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1165
1166 #define NUM_KEYWORDS 1
1167 static struct {
1168 PyGC_Head _this_is_not_used;
1169 PyObject_VAR_HEAD
1170 Py_hash_t ob_hash;
1171 PyObject *ob_item[NUM_KEYWORDS];
1172 } _kwtuple = {
1173 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1174 .ob_hash = -1,
1175 .ob_item = { &_Py_ID(start), },
1176 };
1177 #undef NUM_KEYWORDS
1178 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1179
1180 #else // !Py_BUILD_CORE
1181 # define KWTUPLE NULL
1182 #endif // !Py_BUILD_CORE
1183
1184 static const char * const _keywords[] = {"", "start", NULL};
1185 static _PyArg_Parser _parser = {
1186 .keywords = _keywords,
1187 .fname = "sum",
1188 .kwtuple = KWTUPLE,
1189 };
1190 #undef KWTUPLE
1191 PyObject *argsbuf[2];
1192 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
1193 PyObject *iterable;
1194 PyObject *start = NULL;
1195
1196 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1197 /*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1198 if (!args) {
1199 goto exit;
1200 }
1201 iterable = args[0];
1202 if (!noptargs) {
1203 goto skip_optional_pos;
1204 }
1205 start = args[1];
1206 skip_optional_pos:
1207 return_value = builtin_sum_impl(module, iterable, start);
1208
1209 exit:
1210 return return_value;
1211 }
1212
1213 PyDoc_STRVAR(builtin_isinstance__doc__,
1214 "isinstance($module, obj, class_or_tuple, /)\n"
1215 "--\n"
1216 "\n"
1217 "Return whether an object is an instance of a class or of a subclass thereof.\n"
1218 "\n"
1219 "A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n"
1220 "check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n"
1221 "or ...`` etc.");
1222
1223 #define BUILTIN_ISINSTANCE_METHODDEF \
1224 {"isinstance", _PyCFunction_CAST(builtin_isinstance), METH_FASTCALL, builtin_isinstance__doc__},
1225
1226 static PyObject *
1227 builtin_isinstance_impl(PyObject *module, PyObject *obj,
1228 PyObject *class_or_tuple);
1229
1230 static PyObject *
1231 builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1232 {
1233 PyObject *return_value = NULL;
1234 PyObject *obj;
1235 PyObject *class_or_tuple;
1236
1237 if (!_PyArg_CheckPositional("isinstance", nargs, 2, 2)) {
1238 goto exit;
1239 }
1240 obj = args[0];
1241 class_or_tuple = args[1];
1242 return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
1243
1244 exit:
1245 return return_value;
1246 }
1247
1248 PyDoc_STRVAR(builtin_issubclass__doc__,
1249 "issubclass($module, cls, class_or_tuple, /)\n"
1250 "--\n"
1251 "\n"
1252 "Return whether \'cls\' is derived from another class or is the same class.\n"
1253 "\n"
1254 "A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n"
1255 "check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n"
1256 "or ...``.");
1257
1258 #define BUILTIN_ISSUBCLASS_METHODDEF \
1259 {"issubclass", _PyCFunction_CAST(builtin_issubclass), METH_FASTCALL, builtin_issubclass__doc__},
1260
1261 static PyObject *
1262 builtin_issubclass_impl(PyObject *module, PyObject *cls,
1263 PyObject *class_or_tuple);
1264
1265 static PyObject *
1266 builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1267 {
1268 PyObject *return_value = NULL;
1269 PyObject *cls;
1270 PyObject *class_or_tuple;
1271
1272 if (!_PyArg_CheckPositional("issubclass", nargs, 2, 2)) {
1273 goto exit;
1274 }
1275 cls = args[0];
1276 class_or_tuple = args[1];
1277 return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
1278
1279 exit:
1280 return return_value;
1281 }
1282 /*[clinic end generated code: output=4eb1d06e7e74d91c input=a9049054013a1b77]*/