/* Built-in functions */ #include "Python.h" #include "pycore_ast.h" // _PyAST_Validate() #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _PyEval_Vector() #include "pycore_compile.h" // _PyAST_Compile() #include "pycore_long.h" // _PyLong_CompactValue #include "pycore_modsupport.h" // _PyArg_NoKwnames() #include "pycore_object.h" // _Py_AddToAllObjects() #include "pycore_pyerrors.h" // _PyErr_NoMemory() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pythonrun.h" // _Py_SourceAsString() #include "pycore_sysmodule.h" // _PySys_GetAttr() #include "pycore_tuple.h" // _PyTuple_FromArray() #include "clinic/bltinmodule.c.h" #ifdef HAVE_UNISTD_H # include <unistd.h> // isatty() #endif static PyObject* update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs) { … } /* AC: cannot convert yet, waiting for *args support */ static PyObject * builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { … } PyDoc_STRVAR(build_class_doc, "__build_class__(func, name, /, *bases, [metaclass], **kwds) -> class\n\ \n\ Internal helper function used by the class statement."); /*[clinic input] __import__ as builtin___import__ name: object globals: object(c_default="NULL") = None locals: object(c_default="NULL") = None fromlist: object(c_default="NULL") = () level: int = 0 Import a module. Because this function is meant for use by the Python interpreter and not for general use, it is better to use importlib.import_module() to programmatically import a module. The globals argument is only used to determine the context; they are not modified. The locals argument is unused. The fromlist should be a list of names to emulate ``from name import ...``, or an empty list to emulate ``import name``. When importing a module from a package, note that __import__('A.B', ...) returns package A when fromlist is empty, but its submodule B when fromlist is not empty. The level argument is used to determine whether to perform absolute or relative imports: 0 is absolute, while a positive number is the number of parent directories to search relative to the current module. [clinic start generated code]*/ static PyObject * builtin___import___impl(PyObject *module, PyObject *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) /*[clinic end generated code: output=4febeda88a0cd245 input=73f4b960ea5b9dd6]*/ { … } /*[clinic input] abs as builtin_abs x: object / Return the absolute value of the argument. [clinic start generated code]*/ static PyObject * builtin_abs(PyObject *module, PyObject *x) /*[clinic end generated code: output=b1b433b9e51356f5 input=bed4ca14e29c20d1]*/ { … } /*[clinic input] all as builtin_all iterable: object / Return True if bool(x) is True for all values x in the iterable. If the iterable is empty, return True. [clinic start generated code]*/ static PyObject * builtin_all(PyObject *module, PyObject *iterable) /*[clinic end generated code: output=ca2a7127276f79b3 input=1a7c5d1bc3438a21]*/ { … } /*[clinic input] any as builtin_any iterable: object / Return True if bool(x) is True for any x in the iterable. If the iterable is empty, return False. [clinic start generated code]*/ static PyObject * builtin_any(PyObject *module, PyObject *iterable) /*[clinic end generated code: output=fa65684748caa60e input=41d7451c23384f24]*/ { … } /*[clinic input] ascii as builtin_ascii obj: object / Return an ASCII-only representation of an object. As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \\x, \\u or \\U escapes. This generates a string similar to that returned by repr() in Python 2. [clinic start generated code]*/ static PyObject * builtin_ascii(PyObject *module, PyObject *obj) /*[clinic end generated code: output=6d37b3f0984c7eb9 input=4c62732e1b3a3cc9]*/ { … } /*[clinic input] bin as builtin_bin number: object / Return the binary representation of an integer. >>> bin(2796202) '0b1010101010101010101010' [clinic start generated code]*/ static PyObject * builtin_bin(PyObject *module, PyObject *number) /*[clinic end generated code: output=b6fc4ad5e649f4f7 input=53f8a0264bacaf90]*/ { … } /*[clinic input] callable as builtin_callable obj: object / Return whether the object is callable (i.e., some kind of function). Note that classes are callable, as are instances of classes with a __call__() method. [clinic start generated code]*/ static PyObject * builtin_callable(PyObject *module, PyObject *obj) /*[clinic end generated code: output=2b095d59d934cb7e input=1423bab99cc41f58]*/ { … } static PyObject * builtin_breakpoint(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *keywords) { … } PyDoc_STRVAR(breakpoint_doc, "breakpoint($module, /, *args, **kws)\n\ --\n\ \n\ Call sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept\n\ whatever arguments are passed.\n\ \n\ By default, this drops you into the pdb debugger."); filterobject; static PyObject * filter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { … } static PyObject * filter_vectorcall(PyObject *type, PyObject * const*args, size_t nargsf, PyObject *kwnames) { … } static void filter_dealloc(filterobject *lz) { … } static int filter_traverse(filterobject *lz, visitproc visit, void *arg) { … } static PyObject * filter_next(filterobject *lz) { … } static PyObject * filter_reduce(filterobject *lz, PyObject *Py_UNUSED(ignored)) { … } PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); static PyMethodDef filter_methods[] = …; PyDoc_STRVAR(filter_doc, "filter(function, iterable, /)\n\ --\n\ \n\ Return an iterator yielding those items of iterable for which function(item)\n\ is true. If function is None, return the items that are true."); PyTypeObject PyFilter_Type = …; /*[clinic input] format as builtin_format value: object format_spec: unicode(c_default="NULL") = '' / Return type(value).__format__(value, format_spec) Many built-in types implement format_spec according to the Format Specification Mini-language. See help('FORMATTING'). If type(value) does not supply a method named __format__ and format_spec is empty, then str(value) is returned. See also help('SPECIALMETHODS'). [clinic start generated code]*/ static PyObject * builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec) /*[clinic end generated code: output=2f40bdfa4954b077 input=45ef3934b86d5624]*/ { … } /*[clinic input] chr as builtin_chr i: object / Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. [clinic start generated code]*/ static PyObject * builtin_chr(PyObject *module, PyObject *i) /*[clinic end generated code: output=d34f25b8035a9b10 input=f919867f0ba2f496]*/ { … } /*[clinic input] compile as builtin_compile source: object filename: object(converter="PyUnicode_FSDecoder") mode: str flags: int = 0 dont_inherit: bool = False optimize: int = -1 * _feature_version as feature_version: int = -1 Compile source into a code object that can be executed by exec() or eval(). The source code may represent a Python module, statement or expression. The filename will be used for run-time error messages. The mode must be 'exec' to compile a module, 'single' to compile a single (interactive) statement, or 'eval' to compile an expression. The flags argument, if present, controls which future statements influence the compilation of the code. The dont_inherit argument, if true, stops the compilation inheriting the effects of any future statements in effect in the code calling compile; if absent or false these statements do influence the compilation, in addition to any features explicitly specified. [clinic start generated code]*/ static PyObject * builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize, int feature_version) /*[clinic end generated code: output=b0c09c84f116d3d7 input=cc78e20e7c7682ba]*/ { … } /* AC: cannot convert yet, as needs PEP 457 group support in inspect */ static PyObject * builtin_dir(PyObject *self, PyObject *args) { … } PyDoc_STRVAR(dir_doc, "dir([object]) -> list of strings\n" "\n" "If called without an argument, return the names in the current scope.\n" "Else, return an alphabetized list of names comprising (some of) the attributes\n" "of the given object, and of attributes reachable from it.\n" "If the object supplies a method named __dir__, it will be used; otherwise\n" "the default dir() logic is used and returns:\n" " for a module object: the module's attributes.\n" " for a class object: its attributes, and recursively the attributes\n" " of its bases.\n" " for any other object: its attributes, its class's attributes, and\n" " recursively the attributes of its class's base classes."); /*[clinic input] divmod as builtin_divmod x: object y: object / Return the tuple (x//y, x%y). Invariant: div*y + mod == x. [clinic start generated code]*/ static PyObject * builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y) /*[clinic end generated code: output=b06d8a5f6e0c745e input=175ad9c84ff41a85]*/ { … } /*[clinic input] eval as builtin_eval source: object / globals: object = None locals: object = None Evaluate the given source in the context of globals and locals. The source may be a string representing a Python expression or a code object as returned by compile(). The globals must be a dictionary and locals can be any mapping, defaulting to the current globals and locals. If only globals is given, locals defaults to it. [clinic start generated code]*/ static PyObject * builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, PyObject *locals) /*[clinic end generated code: output=0a0824aa70093116 input=7c7bce5299a89062]*/ { … } /*[clinic input] exec as builtin_exec source: object / globals: object = None locals: object = None * closure: object(c_default="NULL") = None Execute the given source in the context of globals and locals. The source may be a string representing one or more Python statements or a code object as returned by compile(). The globals must be a dictionary and locals can be any mapping, defaulting to the current globals and locals. If only globals is given, locals defaults to it. The closure must be a tuple of cellvars, and can only be used when source is a code object requiring exactly that many cellvars. [clinic start generated code]*/ static PyObject * builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, PyObject *locals, PyObject *closure) /*[clinic end generated code: output=7579eb4e7646743d input=25e989b6d87a3a21]*/ { … } /* AC: cannot convert yet, as needs PEP 457 group support in inspect */ static PyObject * builtin_getattr(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { … } PyDoc_STRVAR(getattr_doc, "getattr(object, name[, default]) -> value\n\ \n\ Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\n\ When a default argument is given, it is returned when the attribute doesn't\n\ exist; without it, an exception is raised in that case."); /*[clinic input] globals as builtin_globals Return the dictionary containing the current scope's global variables. NOTE: Updates to this dictionary *will* affect name lookups in the current global scope and vice-versa. [clinic start generated code]*/ static PyObject * builtin_globals_impl(PyObject *module) /*[clinic end generated code: output=e5dd1527067b94d2 input=9327576f92bb48ba]*/ { … } /*[clinic input] hasattr as builtin_hasattr obj: object name: object / Return whether the object has an attribute with the given name. This is done by calling getattr(obj, name) and catching AttributeError. [clinic start generated code]*/ static PyObject * builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name) /*[clinic end generated code: output=a7aff2090a4151e5 input=0faec9787d979542]*/ { … } /* AC: gdb's integration with CPython relies on builtin_id having * the *exact* parameter names of "self" and "v", so we ensure we * preserve those name rather than using the AC defaults. */ /*[clinic input] id as builtin_id self: self(type="PyModuleDef *") obj as v: object / Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (CPython uses the object's memory address.) [clinic start generated code]*/ static PyObject * builtin_id(PyModuleDef *self, PyObject *v) /*[clinic end generated code: output=0aa640785f697f65 input=5a534136419631f4]*/ { … } /* map object ************************************************************/ mapobject; static PyObject * map_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { … } static PyObject * map_vectorcall(PyObject *type, PyObject * const*args, size_t nargsf, PyObject *kwnames) { … } static void map_dealloc(mapobject *lz) { … } static int map_traverse(mapobject *lz, visitproc visit, void *arg) { … } static PyObject * map_next(mapobject *lz) { … } static PyObject * map_reduce(mapobject *lz, PyObject *Py_UNUSED(ignored)) { … } static PyMethodDef map_methods[] = …; PyDoc_STRVAR(map_doc, "map(function, iterable, /, *iterables)\n\ --\n\ \n\ Make an iterator that computes the function using arguments from\n\ each of the iterables. Stops when the shortest iterable is exhausted."); PyTypeObject PyMap_Type = …; /* AC: cannot convert yet, as needs PEP 457 group support in inspect */ static PyObject * builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { … } PyDoc_STRVAR(next_doc, "next(iterator[, default])\n\ \n\ Return the next item from the iterator. If default is given and the iterator\n\ is exhausted, it is returned instead of raising StopIteration."); /*[clinic input] setattr as builtin_setattr obj: object name: object value: object / Sets the named attribute on the given object to the specified value. setattr(x, 'y', v) is equivalent to ``x.y = v`` [clinic start generated code]*/ static PyObject * builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name, PyObject *value) /*[clinic end generated code: output=dc2ce1d1add9acb4 input=5e26417f2e8598d4]*/ { … } /*[clinic input] delattr as builtin_delattr obj: object name: object / Deletes the named attribute from the given object. delattr(x, 'y') is equivalent to ``del x.y`` [clinic start generated code]*/ static PyObject * builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name) /*[clinic end generated code: output=85134bc58dff79fa input=164865623abe7216]*/ { … } /*[clinic input] hash as builtin_hash obj: object / Return the hash value for the given object. Two objects that compare equal must also have the same hash value, but the reverse is not necessarily true. [clinic start generated code]*/ static PyObject * builtin_hash(PyObject *module, PyObject *obj) /*[clinic end generated code: output=237668e9d7688db7 input=58c48be822bf9c54]*/ { … } /*[clinic input] hex as builtin_hex number: object / Return the hexadecimal representation of an integer. >>> hex(12648430) '0xc0ffee' [clinic start generated code]*/ static PyObject * builtin_hex(PyObject *module, PyObject *number) /*[clinic end generated code: output=e46b612169099408 input=e645aff5fc7d540e]*/ { … } /* AC: cannot convert yet, as needs PEP 457 group support in inspect */ static PyObject * builtin_iter(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { … } PyDoc_STRVAR(iter_doc, "iter(iterable) -> iterator\n\ iter(callable, sentinel) -> iterator\n\ \n\ Get an iterator from an object. In the first form, the argument must\n\ supply its own iterator, or be a sequence.\n\ In the second form, the callable is called until it returns the sentinel."); /*[clinic input] aiter as builtin_aiter async_iterable: object / Return an AsyncIterator for an AsyncIterable object. [clinic start generated code]*/ static PyObject * builtin_aiter(PyObject *module, PyObject *async_iterable) /*[clinic end generated code: output=1bae108d86f7960e input=473993d0cacc7d23]*/ { … } PyObject *PyAnextAwaitable_New(PyObject *, PyObject *); /*[clinic input] anext as builtin_anext aiterator: object default: object = NULL / Return the next item from the async iterator. If default is given and the async iterator is exhausted, it is returned instead of raising StopAsyncIteration. [clinic start generated code]*/ static PyObject * builtin_anext_impl(PyObject *module, PyObject *aiterator, PyObject *default_value) /*[clinic end generated code: output=f02c060c163a81fa input=2900e4a370d39550]*/ { … } /*[clinic input] len as builtin_len obj: object / Return the number of items in a container. [clinic start generated code]*/ static PyObject * builtin_len(PyObject *module, PyObject *obj) /*[clinic end generated code: output=fa7a270d314dfb6c input=bc55598da9e9c9b5]*/ { … } /*[clinic input] locals as builtin_locals Return a dictionary containing the current scope's local variables. NOTE: Whether or not updates to this dictionary will affect name lookups in the local scope and vice-versa is *implementation dependent* and not covered by any backwards compatibility guarantees. [clinic start generated code]*/ static PyObject * builtin_locals_impl(PyObject *module) /*[clinic end generated code: output=b46c94015ce11448 input=7874018d478d5c4b]*/ { … } static PyObject * min_max(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, int op) { … } /* AC: cannot convert yet, waiting for *args support */ static PyObject * builtin_min(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { … } PyDoc_STRVAR(min_doc, "min(iterable, *[, default=obj, key=func]) -> value\n\ min(arg1, arg2, *args, *[, key=func]) -> value\n\ \n\ With a single iterable argument, return its smallest item. The\n\ default keyword-only argument specifies an object to return if\n\ the provided iterable is empty.\n\ With two or more positional arguments, return the smallest argument."); /* AC: cannot convert yet, waiting for *args support */ static PyObject * builtin_max(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { … } PyDoc_STRVAR(max_doc, "max(iterable, *[, default=obj, key=func]) -> value\n\ max(arg1, arg2, *args, *[, key=func]) -> value\n\ \n\ With a single iterable argument, return its biggest item. The\n\ default keyword-only argument specifies an object to return if\n\ the provided iterable is empty.\n\ With two or more positional arguments, return the largest argument."); /*[clinic input] oct as builtin_oct number: object / Return the octal representation of an integer. >>> oct(342391) '0o1234567' [clinic start generated code]*/ static PyObject * builtin_oct(PyObject *module, PyObject *number) /*[clinic end generated code: output=40a34656b6875352 input=ad6b274af4016c72]*/ { … } /*[clinic input] ord as builtin_ord c: object / Return the Unicode code point for a one-character string. [clinic start generated code]*/ static PyObject * builtin_ord(PyObject *module, PyObject *c) /*[clinic end generated code: output=4fa5e87a323bae71 input=3064e5d6203ad012]*/ { … } /*[clinic input] pow as builtin_pow base: object exp: object mod: object = None Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments Some types, such as ints, are able to use a more efficient algorithm when invoked using the three argument form. [clinic start generated code]*/ static PyObject * builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp, PyObject *mod) /*[clinic end generated code: output=3ca1538221bbf15f input=435dbd48a12efb23]*/ { … } /*[clinic input] print as builtin_print *args: object sep: object(c_default="Py_None") = ' ' string inserted between values, default a space. end: object(c_default="Py_None") = '\n' string appended after the last value, default a newline. file: object = None a file-like object (stream); defaults to the current sys.stdout. flush: bool = False whether to forcibly flush the stream. Prints the values to a stream, or to sys.stdout by default. [clinic start generated code]*/ static PyObject * builtin_print_impl(PyObject *module, PyObject *args, PyObject *sep, PyObject *end, PyObject *file, int flush) /*[clinic end generated code: output=3cfc0940f5bc237b input=c143c575d24fe665]*/ { … } /*[clinic input] input as builtin_input prompt: object(c_default="NULL") = "" / Read a string from standard input. The trailing newline is stripped. The prompt string, if given, is printed to standard output without a trailing newline before reading input. If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. On *nix systems, readline is used if available. [clinic start generated code]*/ static PyObject * builtin_input_impl(PyObject *module, PyObject *prompt) /*[clinic end generated code: output=83db5a191e7a0d60 input=159c46d4ae40977e]*/ { … } /*[clinic input] repr as builtin_repr obj: object / Return the canonical string representation of the object. For many object types, including most builtins, eval(repr(obj)) == obj. [clinic start generated code]*/ static PyObject * builtin_repr(PyObject *module, PyObject *obj) /*[clinic end generated code: output=7ed3778c44fd0194 input=1c9e6d66d3e3be04]*/ { … } /*[clinic input] round as builtin_round number: object ndigits: object = None Round a number to a given precision in decimal digits. The return value is an integer if ndigits is omitted or None. Otherwise the return value has the same type as the number. ndigits may be negative. [clinic start generated code]*/ static PyObject * builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits) /*[clinic end generated code: output=ff0d9dd176c02ede input=275678471d7aca15]*/ { … } /*AC: we need to keep the kwds dict intact to easily call into the * list.sort method, which isn't currently supported in AC. So we just use * the initially generated signature with a custom implementation. */ /* [disabled clinic input] sorted as builtin_sorted iterable as seq: object key as keyfunc: object = None reverse: object = False Return a new list containing all items from the iterable in ascending order. A custom key function can be supplied to customize the sort order, and the reverse flag can be set to request the result in descending order. [end disabled clinic input]*/ PyDoc_STRVAR(builtin_sorted__doc__, "sorted($module, iterable, /, *, key=None, reverse=False)\n" "--\n" "\n" "Return a new list containing all items from the iterable in ascending order.\n" "\n" "A custom key function can be supplied to customize the sort order, and the\n" "reverse flag can be set to request the result in descending order."); #define BUILTIN_SORTED_METHODDEF … static PyObject * builtin_sorted(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { … } /* AC: cannot convert yet, as needs PEP 457 group support in inspect */ static PyObject * builtin_vars(PyObject *self, PyObject *args) { … } PyDoc_STRVAR(vars_doc, "vars([object]) -> dictionary\n\ \n\ Without arguments, equivalent to locals().\n\ With an argument, equivalent to object.__dict__."); /* Improved Kahan–Babuška algorithm by Arnold Neumaier Neumaier, A. (1974), Rundungsfehleranalyse einiger Verfahren zur Summation endlicher Summen. Z. angew. Math. Mech., 54: 39-51. https://doi.org/10.1002/zamm.19740540106 https://en.wikipedia.org/wiki/Kahan_summation_algorithm#Further_enhancements */ CompensatedSum; static inline CompensatedSum cs_from_double(double x) { … } static inline CompensatedSum cs_add(CompensatedSum total, double x) { … } static inline double cs_to_double(CompensatedSum total) { … } /*[clinic input] sum as builtin_sum iterable: object / start: object(c_default="NULL") = 0 Return the sum of a 'start' value (default: 0) plus an iterable of numbers When the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types. [clinic start generated code]*/ static PyObject * builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start) /*[clinic end generated code: output=df758cec7d1d302f input=162b50765250d222]*/ { … } /*[clinic input] isinstance as builtin_isinstance obj: object class_or_tuple: object / Return whether an object is an instance of a class or of a subclass thereof. A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B) or ...`` etc. [clinic start generated code]*/ static PyObject * builtin_isinstance_impl(PyObject *module, PyObject *obj, PyObject *class_or_tuple) /*[clinic end generated code: output=6faf01472c13b003 input=ffa743db1daf7549]*/ { … } /*[clinic input] issubclass as builtin_issubclass cls: object class_or_tuple: object / Return whether 'cls' is derived from another class or is the same class. A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B) or ...``. [clinic start generated code]*/ static PyObject * builtin_issubclass_impl(PyObject *module, PyObject *cls, PyObject *class_or_tuple) /*[clinic end generated code: output=358412410cd7a250 input=a24b9f3d58c370d6]*/ { … } zipobject; static PyObject * zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { … } static void zip_dealloc(zipobject *lz) { … } static int zip_traverse(zipobject *lz, visitproc visit, void *arg) { … } static PyObject * zip_next(zipobject *lz) { … } static PyObject * zip_reduce(zipobject *lz, PyObject *Py_UNUSED(ignored)) { … } PyDoc_STRVAR(setstate_doc, "Set state information for unpickling."); static PyObject * zip_setstate(zipobject *lz, PyObject *state) { … } static PyMethodDef zip_methods[] = …; PyDoc_STRVAR(zip_doc, "zip(*iterables, strict=False)\n\ --\n\ \n\ The zip object yields n-length tuples, where n is the number of iterables\n\ passed as positional arguments to zip(). The i-th element in every tuple\n\ comes from the i-th iterable argument to zip(). This continues until the\n\ shortest argument is exhausted.\n\ \n\ If strict is true and one of the arguments is exhausted before the others,\n\ raise a ValueError.\n\ \n\ >>> list(zip('abcdefg', range(3), range(4)))\n\ [('a', 0, 0), ('b', 1, 1), ('c', 2, 2)]"); PyTypeObject PyZip_Type = …; static PyMethodDef builtin_methods[] = …; PyDoc_STRVAR(builtin_doc, "Built-in functions, types, exceptions, and other objects.\n\ \n\ This module provides direct access to all 'built-in'\n\ identifiers of Python; for example, builtins.len is\n\ the full name for the built-in function len().\n\ \n\ This module is not normally accessed explicitly by most\n\ applications, but can be useful in modules that provide\n\ objects with the same name as a built-in value, but in\n\ which the built-in of that name is also needed."); static struct PyModuleDef builtinsmodule = …; PyObject * _PyBuiltin_Init(PyInterpreterState *interp) { … }