diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/python3/src/Python/clinic | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/clinic')
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/_warnings.c.h | 66 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/bltinmodule.c.h | 1282 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/context.c.h | 256 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/import.c.h | 762 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/marshal.c.h | 258 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/sysmodule.c.h | 116 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/traceback.c.h | 62 |
7 files changed, 1401 insertions, 1401 deletions
diff --git a/contrib/tools/python3/src/Python/clinic/_warnings.c.h b/contrib/tools/python3/src/Python/clinic/_warnings.c.h index d1d5ecd5f8..67ab0e3d9d 100644 --- a/contrib/tools/python3/src/Python/clinic/_warnings.c.h +++ b/contrib/tools/python3/src/Python/clinic/_warnings.c.h @@ -1,37 +1,37 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(warnings_warn__doc__, -"warn($module, /, message, category=None, stacklevel=1, source=None)\n" -"--\n" -"\n" -"Issue a warning, or maybe ignore it or raise an exception."); - -#define WARNINGS_WARN_METHODDEF \ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(warnings_warn__doc__, +"warn($module, /, message, category=None, stacklevel=1, source=None)\n" +"--\n" +"\n" +"Issue a warning, or maybe ignore it or raise an exception."); + +#define WARNINGS_WARN_METHODDEF \ {"warn", (PyCFunction)(void(*)(void))warnings_warn, METH_FASTCALL|METH_KEYWORDS, warnings_warn__doc__}, - -static PyObject * -warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, - Py_ssize_t stacklevel, PyObject *source); - -static PyObject * -warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL}; + +static PyObject * +warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, + Py_ssize_t stacklevel, PyObject *source); + +static PyObject * +warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "warn", 0}; PyObject *argsbuf[4]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *message; - PyObject *category = Py_None; - Py_ssize_t stacklevel = 1; - PyObject *source = Py_None; - + PyObject *message; + PyObject *category = Py_None; + Py_ssize_t stacklevel = 1; + PyObject *source = Py_None; + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } message = args[0]; if (!noptargs) { goto skip_optional_pos; @@ -66,9 +66,9 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec } source = args[3]; skip_optional_pos: - return_value = warnings_warn_impl(module, message, category, stacklevel, source); - -exit: - return return_value; -} + return_value = warnings_warn_impl(module, message, category, stacklevel, source); + +exit: + return return_value; +} /*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h b/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h index 94f9fe9950..d15af1f7f3 100644 --- a/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h +++ b/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h @@ -1,102 +1,102 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(builtin_abs__doc__, -"abs($module, x, /)\n" -"--\n" -"\n" -"Return the absolute value of the argument."); - -#define BUILTIN_ABS_METHODDEF \ - {"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__}, - -PyDoc_STRVAR(builtin_all__doc__, -"all($module, iterable, /)\n" -"--\n" -"\n" -"Return True if bool(x) is True for all values x in the iterable.\n" -"\n" -"If the iterable is empty, return True."); - -#define BUILTIN_ALL_METHODDEF \ - {"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__}, - -PyDoc_STRVAR(builtin_any__doc__, -"any($module, iterable, /)\n" -"--\n" -"\n" -"Return True if bool(x) is True for any x in the iterable.\n" -"\n" -"If the iterable is empty, return False."); - -#define BUILTIN_ANY_METHODDEF \ - {"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__}, - -PyDoc_STRVAR(builtin_ascii__doc__, -"ascii($module, obj, /)\n" -"--\n" -"\n" -"Return an ASCII-only representation of an object.\n" -"\n" -"As repr(), return a string containing a printable representation of an\n" -"object, but escape the non-ASCII characters in the string returned by\n" -"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n" -"to that returned by repr() in Python 2."); - -#define BUILTIN_ASCII_METHODDEF \ - {"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__}, - -PyDoc_STRVAR(builtin_bin__doc__, -"bin($module, number, /)\n" -"--\n" -"\n" -"Return the binary representation of an integer.\n" -"\n" -" >>> bin(2796202)\n" -" \'0b1010101010101010101010\'"); - -#define BUILTIN_BIN_METHODDEF \ - {"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__}, - -PyDoc_STRVAR(builtin_callable__doc__, -"callable($module, obj, /)\n" -"--\n" -"\n" -"Return whether the object is callable (i.e., some kind of function).\n" -"\n" -"Note that classes are callable, as are instances of classes with a\n" -"__call__() method."); - -#define BUILTIN_CALLABLE_METHODDEF \ - {"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__}, - -PyDoc_STRVAR(builtin_format__doc__, -"format($module, value, format_spec=\'\', /)\n" -"--\n" -"\n" -"Return value.__format__(format_spec)\n" -"\n" -"format_spec defaults to the empty string.\n" -"See the Format Specification Mini-Language section of help(\'FORMATTING\') for\n" -"details."); - -#define BUILTIN_FORMAT_METHODDEF \ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(builtin_abs__doc__, +"abs($module, x, /)\n" +"--\n" +"\n" +"Return the absolute value of the argument."); + +#define BUILTIN_ABS_METHODDEF \ + {"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__}, + +PyDoc_STRVAR(builtin_all__doc__, +"all($module, iterable, /)\n" +"--\n" +"\n" +"Return True if bool(x) is True for all values x in the iterable.\n" +"\n" +"If the iterable is empty, return True."); + +#define BUILTIN_ALL_METHODDEF \ + {"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__}, + +PyDoc_STRVAR(builtin_any__doc__, +"any($module, iterable, /)\n" +"--\n" +"\n" +"Return True if bool(x) is True for any x in the iterable.\n" +"\n" +"If the iterable is empty, return False."); + +#define BUILTIN_ANY_METHODDEF \ + {"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__}, + +PyDoc_STRVAR(builtin_ascii__doc__, +"ascii($module, obj, /)\n" +"--\n" +"\n" +"Return an ASCII-only representation of an object.\n" +"\n" +"As repr(), return a string containing a printable representation of an\n" +"object, but escape the non-ASCII characters in the string returned by\n" +"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n" +"to that returned by repr() in Python 2."); + +#define BUILTIN_ASCII_METHODDEF \ + {"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__}, + +PyDoc_STRVAR(builtin_bin__doc__, +"bin($module, number, /)\n" +"--\n" +"\n" +"Return the binary representation of an integer.\n" +"\n" +" >>> bin(2796202)\n" +" \'0b1010101010101010101010\'"); + +#define BUILTIN_BIN_METHODDEF \ + {"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__}, + +PyDoc_STRVAR(builtin_callable__doc__, +"callable($module, obj, /)\n" +"--\n" +"\n" +"Return whether the object is callable (i.e., some kind of function).\n" +"\n" +"Note that classes are callable, as are instances of classes with a\n" +"__call__() method."); + +#define BUILTIN_CALLABLE_METHODDEF \ + {"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__}, + +PyDoc_STRVAR(builtin_format__doc__, +"format($module, value, format_spec=\'\', /)\n" +"--\n" +"\n" +"Return value.__format__(format_spec)\n" +"\n" +"format_spec defaults to the empty string.\n" +"See the Format Specification Mini-Language section of help(\'FORMATTING\') for\n" +"details."); + +#define BUILTIN_FORMAT_METHODDEF \ {"format", (PyCFunction)(void(*)(void))builtin_format, METH_FASTCALL, builtin_format__doc__}, - -static PyObject * -builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec); - -static PyObject * -builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - PyObject *format_spec = NULL; - + +static PyObject * +builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec); + +static PyObject * +builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *value; + PyObject *format_spec = NULL; + if (!_PyArg_CheckPositional("format", nargs, 1, 2)) { - goto exit; - } + goto exit; + } value = args[0]; if (nargs < 2) { goto skip_optional; @@ -110,91 +110,91 @@ builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs) } format_spec = args[1]; skip_optional: - return_value = builtin_format_impl(module, value, format_spec); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_chr__doc__, -"chr($module, i, /)\n" -"--\n" -"\n" -"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); - -#define BUILTIN_CHR_METHODDEF \ - {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__}, - -static PyObject * -builtin_chr_impl(PyObject *module, int i); - -static PyObject * -builtin_chr(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int i; - + return_value = builtin_format_impl(module, value, format_spec); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_chr__doc__, +"chr($module, i, /)\n" +"--\n" +"\n" +"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); + +#define BUILTIN_CHR_METHODDEF \ + {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__}, + +static PyObject * +builtin_chr_impl(PyObject *module, int i); + +static PyObject * +builtin_chr(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int i; + if (PyFloat_Check(arg)) { PyErr_SetString(PyExc_TypeError, "integer argument expected, got float" ); - goto exit; - } + goto exit; + } i = _PyLong_AsInt(arg); if (i == -1 && PyErr_Occurred()) { goto exit; } - return_value = builtin_chr_impl(module, i); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_compile__doc__, -"compile($module, /, source, filename, mode, flags=0,\n" + return_value = builtin_chr_impl(module, i); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_compile__doc__, +"compile($module, /, source, filename, mode, flags=0,\n" " dont_inherit=False, optimize=-1, *, _feature_version=-1)\n" -"--\n" -"\n" -"Compile source into a code object that can be executed by exec() or eval().\n" -"\n" -"The source code may represent a Python module, statement or expression.\n" -"The filename will be used for run-time error messages.\n" -"The mode must be \'exec\' to compile a module, \'single\' to compile a\n" -"single (interactive) statement, or \'eval\' to compile an expression.\n" -"The flags argument, if present, controls which future statements influence\n" -"the compilation of the code.\n" -"The dont_inherit argument, if true, stops the compilation inheriting\n" -"the effects of any future statements in effect in the code calling\n" -"compile; if absent or false these statements do influence the compilation,\n" -"in addition to any features explicitly specified."); - -#define BUILTIN_COMPILE_METHODDEF \ +"--\n" +"\n" +"Compile source into a code object that can be executed by exec() or eval().\n" +"\n" +"The source code may represent a Python module, statement or expression.\n" +"The filename will be used for run-time error messages.\n" +"The mode must be \'exec\' to compile a module, \'single\' to compile a\n" +"single (interactive) statement, or \'eval\' to compile an expression.\n" +"The flags argument, if present, controls which future statements influence\n" +"the compilation of the code.\n" +"The dont_inherit argument, if true, stops the compilation inheriting\n" +"the effects of any future statements in effect in the code calling\n" +"compile; if absent or false these statements do influence the compilation,\n" +"in addition to any features explicitly specified."); + +#define BUILTIN_COMPILE_METHODDEF \ {"compile", (PyCFunction)(void(*)(void))builtin_compile, METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__}, - -static PyObject * -builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, - const char *mode, int flags, int dont_inherit, + +static PyObject * +builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename, + const char *mode, int flags, int dont_inherit, int optimize, int feature_version); - -static PyObject * -builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; + +static PyObject * +builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", "_feature_version", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0}; PyObject *argsbuf[7]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; - PyObject *source; - PyObject *filename; - const char *mode; - int flags = 0; - int dont_inherit = 0; - int optimize = -1; + PyObject *source; + PyObject *filename; + const char *mode; + int flags = 0; + int dont_inherit = 0; + int optimize = -1; int feature_version = -1; - + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 6, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } source = args[0]; if (!PyUnicode_FSDecoder(args[1], &filename)) { goto exit; @@ -272,71 +272,71 @@ skip_optional_pos: } skip_optional_kwonly: return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_divmod__doc__, -"divmod($module, x, y, /)\n" -"--\n" -"\n" -"Return the tuple (x//y, x%y). Invariant: div*y + mod == x."); - -#define BUILTIN_DIVMOD_METHODDEF \ + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_divmod__doc__, +"divmod($module, x, y, /)\n" +"--\n" +"\n" +"Return the tuple (x//y, x%y). Invariant: div*y + mod == x."); + +#define BUILTIN_DIVMOD_METHODDEF \ {"divmod", (PyCFunction)(void(*)(void))builtin_divmod, METH_FASTCALL, builtin_divmod__doc__}, - -static PyObject * -builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y); - -static PyObject * -builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *x; - PyObject *y; - + +static PyObject * +builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y); + +static PyObject * +builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *x; + PyObject *y; + if (!_PyArg_CheckPositional("divmod", nargs, 2, 2)) { - goto exit; - } + goto exit; + } x = args[0]; y = args[1]; - return_value = builtin_divmod_impl(module, x, y); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_eval__doc__, -"eval($module, source, globals=None, locals=None, /)\n" -"--\n" -"\n" -"Evaluate the given source in the context of globals and locals.\n" -"\n" -"The source may be a string representing a Python expression\n" -"or a code object as returned by compile().\n" -"The globals must be a dictionary and locals can be any mapping,\n" -"defaulting to the current globals and locals.\n" -"If only globals is given, locals defaults to it."); - -#define BUILTIN_EVAL_METHODDEF \ + return_value = builtin_divmod_impl(module, x, y); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_eval__doc__, +"eval($module, source, globals=None, locals=None, /)\n" +"--\n" +"\n" +"Evaluate the given source in the context of globals and locals.\n" +"\n" +"The source may be a string representing a Python expression\n" +"or a code object as returned by compile().\n" +"The globals must be a dictionary and locals can be any mapping,\n" +"defaulting to the current globals and locals.\n" +"If only globals is given, locals defaults to it."); + +#define BUILTIN_EVAL_METHODDEF \ {"eval", (PyCFunction)(void(*)(void))builtin_eval, METH_FASTCALL, builtin_eval__doc__}, - -static PyObject * -builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, - PyObject *locals); - -static PyObject * -builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *source; - PyObject *globals = Py_None; - PyObject *locals = Py_None; - + +static PyObject * +builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, + PyObject *locals); + +static PyObject * +builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *source; + PyObject *globals = Py_None; + PyObject *locals = Py_None; + if (!_PyArg_CheckPositional("eval", nargs, 1, 3)) { - goto exit; - } + goto exit; + } source = args[0]; if (nargs < 2) { goto skip_optional; @@ -347,42 +347,42 @@ builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs) } locals = args[2]; skip_optional: - return_value = builtin_eval_impl(module, source, globals, locals); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_exec__doc__, -"exec($module, source, globals=None, locals=None, /)\n" -"--\n" -"\n" -"Execute the given source in the context of globals and locals.\n" -"\n" -"The source may be a string representing one or more Python statements\n" -"or a code object as returned by compile().\n" -"The globals must be a dictionary and locals can be any mapping,\n" -"defaulting to the current globals and locals.\n" -"If only globals is given, locals defaults to it."); - -#define BUILTIN_EXEC_METHODDEF \ + return_value = builtin_eval_impl(module, source, globals, locals); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_exec__doc__, +"exec($module, source, globals=None, locals=None, /)\n" +"--\n" +"\n" +"Execute the given source in the context of globals and locals.\n" +"\n" +"The source may be a string representing one or more Python statements\n" +"or a code object as returned by compile().\n" +"The globals must be a dictionary and locals can be any mapping,\n" +"defaulting to the current globals and locals.\n" +"If only globals is given, locals defaults to it."); + +#define BUILTIN_EXEC_METHODDEF \ {"exec", (PyCFunction)(void(*)(void))builtin_exec, METH_FASTCALL, builtin_exec__doc__}, - -static PyObject * -builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, - PyObject *locals); - -static PyObject * -builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *source; - PyObject *globals = Py_None; - PyObject *locals = Py_None; - + +static PyObject * +builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, + PyObject *locals); + +static PyObject * +builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *source; + PyObject *globals = Py_None; + PyObject *locals = Py_None; + if (!_PyArg_CheckPositional("exec", nargs, 1, 3)) { - goto exit; - } + goto exit; + } source = args[0]; if (nargs < 2) { goto skip_optional; @@ -393,240 +393,240 @@ builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs) } locals = args[2]; skip_optional: - return_value = builtin_exec_impl(module, source, globals, locals); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_globals__doc__, -"globals($module, /)\n" -"--\n" -"\n" -"Return the dictionary containing the current scope\'s global variables.\n" -"\n" -"NOTE: Updates to this dictionary *will* affect name lookups in the current\n" -"global scope and vice-versa."); - -#define BUILTIN_GLOBALS_METHODDEF \ - {"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__}, - -static PyObject * -builtin_globals_impl(PyObject *module); - -static PyObject * -builtin_globals(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return builtin_globals_impl(module); -} - -PyDoc_STRVAR(builtin_hasattr__doc__, -"hasattr($module, obj, name, /)\n" -"--\n" -"\n" -"Return whether the object has an attribute with the given name.\n" -"\n" -"This is done by calling getattr(obj, name) and catching AttributeError."); - -#define BUILTIN_HASATTR_METHODDEF \ + return_value = builtin_exec_impl(module, source, globals, locals); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_globals__doc__, +"globals($module, /)\n" +"--\n" +"\n" +"Return the dictionary containing the current scope\'s global variables.\n" +"\n" +"NOTE: Updates to this dictionary *will* affect name lookups in the current\n" +"global scope and vice-versa."); + +#define BUILTIN_GLOBALS_METHODDEF \ + {"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__}, + +static PyObject * +builtin_globals_impl(PyObject *module); + +static PyObject * +builtin_globals(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return builtin_globals_impl(module); +} + +PyDoc_STRVAR(builtin_hasattr__doc__, +"hasattr($module, obj, name, /)\n" +"--\n" +"\n" +"Return whether the object has an attribute with the given name.\n" +"\n" +"This is done by calling getattr(obj, name) and catching AttributeError."); + +#define BUILTIN_HASATTR_METHODDEF \ {"hasattr", (PyCFunction)(void(*)(void))builtin_hasattr, METH_FASTCALL, builtin_hasattr__doc__}, - -static PyObject * -builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name); - -static PyObject * -builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - + +static PyObject * +builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name); + +static PyObject * +builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *obj; + PyObject *name; + if (!_PyArg_CheckPositional("hasattr", nargs, 2, 2)) { - goto exit; - } + goto exit; + } obj = args[0]; name = args[1]; - return_value = builtin_hasattr_impl(module, obj, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_id__doc__, -"id($module, obj, /)\n" -"--\n" -"\n" -"Return the identity of an object.\n" -"\n" -"This is guaranteed to be unique among simultaneously existing objects.\n" -"(CPython uses the object\'s memory address.)"); - -#define BUILTIN_ID_METHODDEF \ - {"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__}, - -PyDoc_STRVAR(builtin_setattr__doc__, -"setattr($module, obj, name, value, /)\n" -"--\n" -"\n" -"Sets the named attribute on the given object to the specified value.\n" -"\n" -"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'"); - -#define BUILTIN_SETATTR_METHODDEF \ + return_value = builtin_hasattr_impl(module, obj, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_id__doc__, +"id($module, obj, /)\n" +"--\n" +"\n" +"Return the identity of an object.\n" +"\n" +"This is guaranteed to be unique among simultaneously existing objects.\n" +"(CPython uses the object\'s memory address.)"); + +#define BUILTIN_ID_METHODDEF \ + {"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__}, + +PyDoc_STRVAR(builtin_setattr__doc__, +"setattr($module, obj, name, value, /)\n" +"--\n" +"\n" +"Sets the named attribute on the given object to the specified value.\n" +"\n" +"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'"); + +#define BUILTIN_SETATTR_METHODDEF \ {"setattr", (PyCFunction)(void(*)(void))builtin_setattr, METH_FASTCALL, builtin_setattr__doc__}, - -static PyObject * -builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name, - PyObject *value); - -static PyObject * -builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - PyObject *value; - + +static PyObject * +builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name, + PyObject *value); + +static PyObject * +builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *obj; + PyObject *name; + PyObject *value; + if (!_PyArg_CheckPositional("setattr", nargs, 3, 3)) { - goto exit; - } + goto exit; + } obj = args[0]; name = args[1]; value = args[2]; - return_value = builtin_setattr_impl(module, obj, name, value); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_delattr__doc__, -"delattr($module, obj, name, /)\n" -"--\n" -"\n" -"Deletes the named attribute from the given object.\n" -"\n" -"delattr(x, \'y\') is equivalent to ``del x.y\'\'"); - -#define BUILTIN_DELATTR_METHODDEF \ + return_value = builtin_setattr_impl(module, obj, name, value); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_delattr__doc__, +"delattr($module, obj, name, /)\n" +"--\n" +"\n" +"Deletes the named attribute from the given object.\n" +"\n" +"delattr(x, \'y\') is equivalent to ``del x.y\'\'"); + +#define BUILTIN_DELATTR_METHODDEF \ {"delattr", (PyCFunction)(void(*)(void))builtin_delattr, METH_FASTCALL, builtin_delattr__doc__}, - -static PyObject * -builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name); - -static PyObject * -builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - + +static PyObject * +builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name); + +static PyObject * +builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *obj; + PyObject *name; + if (!_PyArg_CheckPositional("delattr", nargs, 2, 2)) { - goto exit; - } + goto exit; + } obj = args[0]; name = args[1]; - return_value = builtin_delattr_impl(module, obj, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_hash__doc__, -"hash($module, obj, /)\n" -"--\n" -"\n" -"Return the hash value for the given object.\n" -"\n" -"Two objects that compare equal must also have the same hash value, but the\n" -"reverse is not necessarily true."); - -#define BUILTIN_HASH_METHODDEF \ - {"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__}, - -PyDoc_STRVAR(builtin_hex__doc__, -"hex($module, number, /)\n" -"--\n" -"\n" -"Return the hexadecimal representation of an integer.\n" -"\n" -" >>> hex(12648430)\n" -" \'0xc0ffee\'"); - -#define BUILTIN_HEX_METHODDEF \ - {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__}, - -PyDoc_STRVAR(builtin_len__doc__, -"len($module, obj, /)\n" -"--\n" -"\n" -"Return the number of items in a container."); - -#define BUILTIN_LEN_METHODDEF \ - {"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__}, - -PyDoc_STRVAR(builtin_locals__doc__, -"locals($module, /)\n" -"--\n" -"\n" -"Return a dictionary containing the current scope\'s local variables.\n" -"\n" -"NOTE: Whether or not updates to this dictionary will affect name lookups in\n" -"the local scope and vice-versa is *implementation dependent* and not\n" -"covered by any backwards compatibility guarantees."); - -#define BUILTIN_LOCALS_METHODDEF \ - {"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__}, - -static PyObject * -builtin_locals_impl(PyObject *module); - -static PyObject * -builtin_locals(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return builtin_locals_impl(module); -} - -PyDoc_STRVAR(builtin_oct__doc__, -"oct($module, number, /)\n" -"--\n" -"\n" -"Return the octal representation of an integer.\n" -"\n" -" >>> oct(342391)\n" -" \'0o1234567\'"); - -#define BUILTIN_OCT_METHODDEF \ - {"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__}, - -PyDoc_STRVAR(builtin_ord__doc__, -"ord($module, c, /)\n" -"--\n" -"\n" -"Return the Unicode code point for a one-character string."); - -#define BUILTIN_ORD_METHODDEF \ - {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__}, - -PyDoc_STRVAR(builtin_pow__doc__, + return_value = builtin_delattr_impl(module, obj, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_hash__doc__, +"hash($module, obj, /)\n" +"--\n" +"\n" +"Return the hash value for the given object.\n" +"\n" +"Two objects that compare equal must also have the same hash value, but the\n" +"reverse is not necessarily true."); + +#define BUILTIN_HASH_METHODDEF \ + {"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__}, + +PyDoc_STRVAR(builtin_hex__doc__, +"hex($module, number, /)\n" +"--\n" +"\n" +"Return the hexadecimal representation of an integer.\n" +"\n" +" >>> hex(12648430)\n" +" \'0xc0ffee\'"); + +#define BUILTIN_HEX_METHODDEF \ + {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__}, + +PyDoc_STRVAR(builtin_len__doc__, +"len($module, obj, /)\n" +"--\n" +"\n" +"Return the number of items in a container."); + +#define BUILTIN_LEN_METHODDEF \ + {"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__}, + +PyDoc_STRVAR(builtin_locals__doc__, +"locals($module, /)\n" +"--\n" +"\n" +"Return a dictionary containing the current scope\'s local variables.\n" +"\n" +"NOTE: Whether or not updates to this dictionary will affect name lookups in\n" +"the local scope and vice-versa is *implementation dependent* and not\n" +"covered by any backwards compatibility guarantees."); + +#define BUILTIN_LOCALS_METHODDEF \ + {"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__}, + +static PyObject * +builtin_locals_impl(PyObject *module); + +static PyObject * +builtin_locals(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return builtin_locals_impl(module); +} + +PyDoc_STRVAR(builtin_oct__doc__, +"oct($module, number, /)\n" +"--\n" +"\n" +"Return the octal representation of an integer.\n" +"\n" +" >>> oct(342391)\n" +" \'0o1234567\'"); + +#define BUILTIN_OCT_METHODDEF \ + {"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__}, + +PyDoc_STRVAR(builtin_ord__doc__, +"ord($module, c, /)\n" +"--\n" +"\n" +"Return the Unicode code point for a one-character string."); + +#define BUILTIN_ORD_METHODDEF \ + {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__}, + +PyDoc_STRVAR(builtin_pow__doc__, "pow($module, /, base, exp, mod=None)\n" -"--\n" -"\n" +"--\n" +"\n" "Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments\n" -"\n" -"Some types, such as ints, are able to use a more efficient algorithm when\n" -"invoked using the three argument form."); - -#define BUILTIN_POW_METHODDEF \ +"\n" +"Some types, such as ints, are able to use a more efficient algorithm when\n" +"invoked using the three argument form."); + +#define BUILTIN_POW_METHODDEF \ {"pow", (PyCFunction)(void(*)(void))builtin_pow, METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__}, - -static PyObject * + +static PyObject * builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp, PyObject *mod); - -static PyObject * + +static PyObject * builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; +{ + PyObject *return_value = NULL; static const char * const _keywords[] = {"base", "exp", "mod", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "pow", 0}; PyObject *argsbuf[3]; @@ -634,11 +634,11 @@ builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject PyObject *base; PyObject *exp; PyObject *mod = Py_None; - + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } base = args[0]; exp = args[1]; if (!noptargs) { @@ -647,212 +647,212 @@ builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject mod = args[2]; skip_optional_pos: return_value = builtin_pow_impl(module, base, exp, mod); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_input__doc__, -"input($module, prompt=None, /)\n" -"--\n" -"\n" -"Read a string from standard input. The trailing newline is stripped.\n" -"\n" -"The prompt string, if given, is printed to standard output without a\n" -"trailing newline before reading input.\n" -"\n" -"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n" -"On *nix systems, readline is used if available."); - -#define BUILTIN_INPUT_METHODDEF \ + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_input__doc__, +"input($module, prompt=None, /)\n" +"--\n" +"\n" +"Read a string from standard input. The trailing newline is stripped.\n" +"\n" +"The prompt string, if given, is printed to standard output without a\n" +"trailing newline before reading input.\n" +"\n" +"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n" +"On *nix systems, readline is used if available."); + +#define BUILTIN_INPUT_METHODDEF \ {"input", (PyCFunction)(void(*)(void))builtin_input, METH_FASTCALL, builtin_input__doc__}, - -static PyObject * -builtin_input_impl(PyObject *module, PyObject *prompt); - -static PyObject * -builtin_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *prompt = NULL; - + +static PyObject * +builtin_input_impl(PyObject *module, PyObject *prompt); + +static PyObject * +builtin_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *prompt = NULL; + if (!_PyArg_CheckPositional("input", nargs, 0, 1)) { - goto exit; - } + goto exit; + } if (nargs < 1) { goto skip_optional; } prompt = args[0]; skip_optional: - return_value = builtin_input_impl(module, prompt); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_repr__doc__, -"repr($module, obj, /)\n" -"--\n" -"\n" -"Return the canonical string representation of the object.\n" -"\n" -"For many object types, including most builtins, eval(repr(obj)) == obj."); - -#define BUILTIN_REPR_METHODDEF \ - {"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__}, - -PyDoc_STRVAR(builtin_round__doc__, -"round($module, /, number, ndigits=None)\n" -"--\n" -"\n" -"Round a number to a given precision in decimal digits.\n" -"\n" -"The return value is an integer if ndigits is omitted or None. Otherwise\n" -"the return value has the same type as the number. ndigits may be negative."); - -#define BUILTIN_ROUND_METHODDEF \ + return_value = builtin_input_impl(module, prompt); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_repr__doc__, +"repr($module, obj, /)\n" +"--\n" +"\n" +"Return the canonical string representation of the object.\n" +"\n" +"For many object types, including most builtins, eval(repr(obj)) == obj."); + +#define BUILTIN_REPR_METHODDEF \ + {"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__}, + +PyDoc_STRVAR(builtin_round__doc__, +"round($module, /, number, ndigits=None)\n" +"--\n" +"\n" +"Round a number to a given precision in decimal digits.\n" +"\n" +"The return value is an integer if ndigits is omitted or None. Otherwise\n" +"the return value has the same type as the number. ndigits may be negative."); + +#define BUILTIN_ROUND_METHODDEF \ {"round", (PyCFunction)(void(*)(void))builtin_round, METH_FASTCALL|METH_KEYWORDS, builtin_round__doc__}, - -static PyObject * -builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits); - -static PyObject * -builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"number", "ndigits", NULL}; + +static PyObject * +builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits); + +static PyObject * +builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"number", "ndigits", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "round", 0}; PyObject *argsbuf[2]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *number; + PyObject *number; PyObject *ndigits = Py_None; - + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } number = args[0]; if (!noptargs) { goto skip_optional_pos; } ndigits = args[1]; skip_optional_pos: - return_value = builtin_round_impl(module, number, ndigits); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_sum__doc__, + return_value = builtin_round_impl(module, number, ndigits); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_sum__doc__, "sum($module, iterable, /, start=0)\n" -"--\n" -"\n" -"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n" -"\n" -"When the iterable is empty, return the start value.\n" -"This function is intended specifically for use with numeric values and may\n" -"reject non-numeric types."); - -#define BUILTIN_SUM_METHODDEF \ +"--\n" +"\n" +"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n" +"\n" +"When the iterable is empty, return the start value.\n" +"This function is intended specifically for use with numeric values and may\n" +"reject non-numeric types."); + +#define BUILTIN_SUM_METHODDEF \ {"sum", (PyCFunction)(void(*)(void))builtin_sum, METH_FASTCALL|METH_KEYWORDS, builtin_sum__doc__}, - -static PyObject * -builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start); - -static PyObject * + +static PyObject * +builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start); + +static PyObject * builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; +{ + PyObject *return_value = NULL; static const char * const _keywords[] = {"", "start", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "sum", 0}; PyObject *argsbuf[2]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *iterable; - PyObject *start = NULL; - + PyObject *iterable; + PyObject *start = NULL; + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } iterable = args[0]; if (!noptargs) { goto skip_optional_pos; } start = args[1]; skip_optional_pos: - return_value = builtin_sum_impl(module, iterable, start); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_isinstance__doc__, -"isinstance($module, obj, class_or_tuple, /)\n" -"--\n" -"\n" -"Return whether an object is an instance of a class or of a subclass thereof.\n" -"\n" -"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n" -"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n" -"or ...`` etc."); - -#define BUILTIN_ISINSTANCE_METHODDEF \ + return_value = builtin_sum_impl(module, iterable, start); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_isinstance__doc__, +"isinstance($module, obj, class_or_tuple, /)\n" +"--\n" +"\n" +"Return whether an object is an instance of a class or of a subclass thereof.\n" +"\n" +"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n" +"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n" +"or ...`` etc."); + +#define BUILTIN_ISINSTANCE_METHODDEF \ {"isinstance", (PyCFunction)(void(*)(void))builtin_isinstance, METH_FASTCALL, builtin_isinstance__doc__}, - -static PyObject * -builtin_isinstance_impl(PyObject *module, PyObject *obj, - PyObject *class_or_tuple); - -static PyObject * -builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *class_or_tuple; - + +static PyObject * +builtin_isinstance_impl(PyObject *module, PyObject *obj, + PyObject *class_or_tuple); + +static PyObject * +builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *obj; + PyObject *class_or_tuple; + if (!_PyArg_CheckPositional("isinstance", nargs, 2, 2)) { - goto exit; - } + goto exit; + } obj = args[0]; class_or_tuple = args[1]; - return_value = builtin_isinstance_impl(module, obj, class_or_tuple); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_issubclass__doc__, -"issubclass($module, cls, class_or_tuple, /)\n" -"--\n" -"\n" -"Return whether \'cls\' is a derived from another class or is the same class.\n" -"\n" -"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n" -"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n" -"or ...`` etc."); - -#define BUILTIN_ISSUBCLASS_METHODDEF \ + return_value = builtin_isinstance_impl(module, obj, class_or_tuple); + +exit: + return return_value; +} + +PyDoc_STRVAR(builtin_issubclass__doc__, +"issubclass($module, cls, class_or_tuple, /)\n" +"--\n" +"\n" +"Return whether \'cls\' is a derived from another class or is the same class.\n" +"\n" +"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n" +"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n" +"or ...`` etc."); + +#define BUILTIN_ISSUBCLASS_METHODDEF \ {"issubclass", (PyCFunction)(void(*)(void))builtin_issubclass, METH_FASTCALL, builtin_issubclass__doc__}, - -static PyObject * -builtin_issubclass_impl(PyObject *module, PyObject *cls, - PyObject *class_or_tuple); - -static PyObject * -builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *cls; - PyObject *class_or_tuple; - + +static PyObject * +builtin_issubclass_impl(PyObject *module, PyObject *cls, + PyObject *class_or_tuple); + +static PyObject * +builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *cls; + PyObject *class_or_tuple; + if (!_PyArg_CheckPositional("issubclass", nargs, 2, 2)) { - goto exit; - } + goto exit; + } cls = args[0]; class_or_tuple = args[1]; - return_value = builtin_issubclass_impl(module, cls, class_or_tuple); - -exit: - return return_value; -} + return_value = builtin_issubclass_impl(module, cls, class_or_tuple); + +exit: + return return_value; +} /*[clinic end generated code: output=29686a89b739d600 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/context.c.h b/contrib/tools/python3/src/Python/clinic/context.c.h index e744087ff6..2ac8bf7c0b 100644 --- a/contrib/tools/python3/src/Python/clinic/context.c.h +++ b/contrib/tools/python3/src/Python/clinic/context.c.h @@ -1,122 +1,122 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(_contextvars_Context_get__doc__, -"get($self, key, default=None, /)\n" -"--\n" +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_contextvars_Context_get__doc__, +"get($self, key, default=None, /)\n" +"--\n" "\n" "Return the value for `key` if `key` has the value in the context object.\n" "\n" "If `key` does not exist, return `default`. If `default` is not given,\n" "return None."); - -#define _CONTEXTVARS_CONTEXT_GET_METHODDEF \ + +#define _CONTEXTVARS_CONTEXT_GET_METHODDEF \ {"get", (PyCFunction)(void(*)(void))_contextvars_Context_get, METH_FASTCALL, _contextvars_Context_get__doc__}, - -static PyObject * -_contextvars_Context_get_impl(PyContext *self, PyObject *key, - PyObject *default_value); - -static PyObject * -_contextvars_Context_get(PyContext *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *key; - PyObject *default_value = Py_None; - + +static PyObject * +_contextvars_Context_get_impl(PyContext *self, PyObject *key, + PyObject *default_value); + +static PyObject * +_contextvars_Context_get(PyContext *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *key; + PyObject *default_value = Py_None; + if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { - goto exit; - } + goto exit; + } key = args[0]; if (nargs < 2) { goto skip_optional; } default_value = args[1]; skip_optional: - return_value = _contextvars_Context_get_impl(self, key, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_contextvars_Context_items__doc__, -"items($self, /)\n" -"--\n" + return_value = _contextvars_Context_get_impl(self, key, default_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_contextvars_Context_items__doc__, +"items($self, /)\n" +"--\n" "\n" "Return all variables and their values in the context object.\n" "\n" "The result is returned as a list of 2-tuples (variable, value)."); - -#define _CONTEXTVARS_CONTEXT_ITEMS_METHODDEF \ - {"items", (PyCFunction)_contextvars_Context_items, METH_NOARGS, _contextvars_Context_items__doc__}, - -static PyObject * -_contextvars_Context_items_impl(PyContext *self); - -static PyObject * -_contextvars_Context_items(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_items_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_keys__doc__, -"keys($self, /)\n" -"--\n" + +#define _CONTEXTVARS_CONTEXT_ITEMS_METHODDEF \ + {"items", (PyCFunction)_contextvars_Context_items, METH_NOARGS, _contextvars_Context_items__doc__}, + +static PyObject * +_contextvars_Context_items_impl(PyContext *self); + +static PyObject * +_contextvars_Context_items(PyContext *self, PyObject *Py_UNUSED(ignored)) +{ + return _contextvars_Context_items_impl(self); +} + +PyDoc_STRVAR(_contextvars_Context_keys__doc__, +"keys($self, /)\n" +"--\n" "\n" "Return a list of all variables in the context object."); - -#define _CONTEXTVARS_CONTEXT_KEYS_METHODDEF \ - {"keys", (PyCFunction)_contextvars_Context_keys, METH_NOARGS, _contextvars_Context_keys__doc__}, - -static PyObject * -_contextvars_Context_keys_impl(PyContext *self); - -static PyObject * -_contextvars_Context_keys(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_keys_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_values__doc__, -"values($self, /)\n" -"--\n" + +#define _CONTEXTVARS_CONTEXT_KEYS_METHODDEF \ + {"keys", (PyCFunction)_contextvars_Context_keys, METH_NOARGS, _contextvars_Context_keys__doc__}, + +static PyObject * +_contextvars_Context_keys_impl(PyContext *self); + +static PyObject * +_contextvars_Context_keys(PyContext *self, PyObject *Py_UNUSED(ignored)) +{ + return _contextvars_Context_keys_impl(self); +} + +PyDoc_STRVAR(_contextvars_Context_values__doc__, +"values($self, /)\n" +"--\n" "\n" "Return a list of all variables\' values in the context object."); - -#define _CONTEXTVARS_CONTEXT_VALUES_METHODDEF \ - {"values", (PyCFunction)_contextvars_Context_values, METH_NOARGS, _contextvars_Context_values__doc__}, - -static PyObject * -_contextvars_Context_values_impl(PyContext *self); - -static PyObject * -_contextvars_Context_values(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_values_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_copy__doc__, -"copy($self, /)\n" -"--\n" + +#define _CONTEXTVARS_CONTEXT_VALUES_METHODDEF \ + {"values", (PyCFunction)_contextvars_Context_values, METH_NOARGS, _contextvars_Context_values__doc__}, + +static PyObject * +_contextvars_Context_values_impl(PyContext *self); + +static PyObject * +_contextvars_Context_values(PyContext *self, PyObject *Py_UNUSED(ignored)) +{ + return _contextvars_Context_values_impl(self); +} + +PyDoc_STRVAR(_contextvars_Context_copy__doc__, +"copy($self, /)\n" +"--\n" "\n" "Return a shallow copy of the context object."); - -#define _CONTEXTVARS_CONTEXT_COPY_METHODDEF \ - {"copy", (PyCFunction)_contextvars_Context_copy, METH_NOARGS, _contextvars_Context_copy__doc__}, - -static PyObject * -_contextvars_Context_copy_impl(PyContext *self); - -static PyObject * -_contextvars_Context_copy(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_copy_impl(self); -} - -PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, + +#define _CONTEXTVARS_CONTEXT_COPY_METHODDEF \ + {"copy", (PyCFunction)_contextvars_Context_copy, METH_NOARGS, _contextvars_Context_copy__doc__}, + +static PyObject * +_contextvars_Context_copy_impl(PyContext *self); + +static PyObject * +_contextvars_Context_copy(PyContext *self, PyObject *Py_UNUSED(ignored)) +{ + return _contextvars_Context_copy_impl(self); +} + +PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, "get($self, default=<unrepresentable>, /)\n" -"--\n" +"--\n" "\n" "Return a value for the context variable for the current context.\n" "\n" @@ -125,36 +125,36 @@ PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, " * return the default value for the context variable, if it was created\n" " with one; or\n" " * raise a LookupError."); - -#define _CONTEXTVARS_CONTEXTVAR_GET_METHODDEF \ + +#define _CONTEXTVARS_CONTEXTVAR_GET_METHODDEF \ {"get", (PyCFunction)(void(*)(void))_contextvars_ContextVar_get, METH_FASTCALL, _contextvars_ContextVar_get__doc__}, - -static PyObject * -_contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value); - -static PyObject * -_contextvars_ContextVar_get(PyContextVar *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *default_value = NULL; - + +static PyObject * +_contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value); + +static PyObject * +_contextvars_ContextVar_get(PyContextVar *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *default_value = NULL; + if (!_PyArg_CheckPositional("get", nargs, 0, 1)) { - goto exit; - } + goto exit; + } if (nargs < 1) { goto skip_optional; } default_value = args[0]; skip_optional: - return_value = _contextvars_ContextVar_get_impl(self, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_contextvars_ContextVar_set__doc__, -"set($self, value, /)\n" -"--\n" + return_value = _contextvars_ContextVar_get_impl(self, default_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_contextvars_ContextVar_set__doc__, +"set($self, value, /)\n" +"--\n" "\n" "Call to set a new value for the context variable in the current context.\n" "\n" @@ -162,19 +162,19 @@ PyDoc_STRVAR(_contextvars_ContextVar_set__doc__, "\n" "Returns a Token object that can be used to restore the variable to its previous\n" "value via the `ContextVar.reset()` method."); - -#define _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF \ - {"set", (PyCFunction)_contextvars_ContextVar_set, METH_O, _contextvars_ContextVar_set__doc__}, - -PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__, -"reset($self, token, /)\n" -"--\n" + +#define _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF \ + {"set", (PyCFunction)_contextvars_ContextVar_set, METH_O, _contextvars_ContextVar_set__doc__}, + +PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__, +"reset($self, token, /)\n" +"--\n" "\n" "Reset the context variable.\n" "\n" "The variable is reset to the value it had before the `ContextVar.set()` that\n" "created the token was used."); - -#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \ - {"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__}, + +#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \ + {"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__}, /*[clinic end generated code: output=f2e42f34e358e179 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/import.c.h b/contrib/tools/python3/src/Python/clinic/import.c.h index 0a580564ad..e4867f34d4 100644 --- a/contrib/tools/python3/src/Python/clinic/import.c.h +++ b/contrib/tools/python3/src/Python/clinic/import.c.h @@ -1,96 +1,96 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(_imp_lock_held__doc__, -"lock_held($module, /)\n" -"--\n" -"\n" -"Return True if the import lock is currently held, else False.\n" -"\n" -"On platforms without threads, return False."); - -#define _IMP_LOCK_HELD_METHODDEF \ - {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__}, - -static PyObject * -_imp_lock_held_impl(PyObject *module); - -static PyObject * -_imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_lock_held_impl(module); -} - -PyDoc_STRVAR(_imp_acquire_lock__doc__, -"acquire_lock($module, /)\n" -"--\n" -"\n" -"Acquires the interpreter\'s import lock for the current thread.\n" -"\n" -"This lock should be used by import hooks to ensure thread-safety when importing\n" -"modules. On platforms without threads, this function does nothing."); - -#define _IMP_ACQUIRE_LOCK_METHODDEF \ - {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__}, - -static PyObject * -_imp_acquire_lock_impl(PyObject *module); - -static PyObject * -_imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_acquire_lock_impl(module); -} - -PyDoc_STRVAR(_imp_release_lock__doc__, -"release_lock($module, /)\n" -"--\n" -"\n" -"Release the interpreter\'s import lock.\n" -"\n" -"On platforms without threads, this function does nothing."); - -#define _IMP_RELEASE_LOCK_METHODDEF \ - {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__}, - -static PyObject * -_imp_release_lock_impl(PyObject *module); - -static PyObject * -_imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_release_lock_impl(module); -} - -PyDoc_STRVAR(_imp__fix_co_filename__doc__, -"_fix_co_filename($module, code, path, /)\n" -"--\n" -"\n" -"Changes code.co_filename to specify the passed-in file path.\n" -"\n" -" code\n" -" Code object to change.\n" -" path\n" -" File path to use."); - -#define _IMP__FIX_CO_FILENAME_METHODDEF \ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_imp_lock_held__doc__, +"lock_held($module, /)\n" +"--\n" +"\n" +"Return True if the import lock is currently held, else False.\n" +"\n" +"On platforms without threads, return False."); + +#define _IMP_LOCK_HELD_METHODDEF \ + {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__}, + +static PyObject * +_imp_lock_held_impl(PyObject *module); + +static PyObject * +_imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _imp_lock_held_impl(module); +} + +PyDoc_STRVAR(_imp_acquire_lock__doc__, +"acquire_lock($module, /)\n" +"--\n" +"\n" +"Acquires the interpreter\'s import lock for the current thread.\n" +"\n" +"This lock should be used by import hooks to ensure thread-safety when importing\n" +"modules. On platforms without threads, this function does nothing."); + +#define _IMP_ACQUIRE_LOCK_METHODDEF \ + {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__}, + +static PyObject * +_imp_acquire_lock_impl(PyObject *module); + +static PyObject * +_imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _imp_acquire_lock_impl(module); +} + +PyDoc_STRVAR(_imp_release_lock__doc__, +"release_lock($module, /)\n" +"--\n" +"\n" +"Release the interpreter\'s import lock.\n" +"\n" +"On platforms without threads, this function does nothing."); + +#define _IMP_RELEASE_LOCK_METHODDEF \ + {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__}, + +static PyObject * +_imp_release_lock_impl(PyObject *module); + +static PyObject * +_imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _imp_release_lock_impl(module); +} + +PyDoc_STRVAR(_imp__fix_co_filename__doc__, +"_fix_co_filename($module, code, path, /)\n" +"--\n" +"\n" +"Changes code.co_filename to specify the passed-in file path.\n" +"\n" +" code\n" +" Code object to change.\n" +" path\n" +" File path to use."); + +#define _IMP__FIX_CO_FILENAME_METHODDEF \ {"_fix_co_filename", (PyCFunction)(void(*)(void))_imp__fix_co_filename, METH_FASTCALL, _imp__fix_co_filename__doc__}, - -static PyObject * -_imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code, - PyObject *path); - -static PyObject * -_imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyCodeObject *code; - PyObject *path; - + +static PyObject * +_imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code, + PyObject *path); + +static PyObject * +_imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyCodeObject *code; + PyObject *path; + if (!_PyArg_CheckPositional("_fix_co_filename", nargs, 2, 2)) { - goto exit; - } + goto exit; + } if (!PyObject_TypeCheck(args[0], &PyCode_Type)) { _PyArg_BadArgument("_fix_co_filename", "argument 1", (&PyCode_Type)->tp_name, args[0]); goto exit; @@ -104,322 +104,322 @@ _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs) goto exit; } path = args[1]; - return_value = _imp__fix_co_filename_impl(module, code, path); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_create_builtin__doc__, -"create_builtin($module, spec, /)\n" -"--\n" -"\n" -"Create an extension module."); - -#define _IMP_CREATE_BUILTIN_METHODDEF \ - {"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__}, - -PyDoc_STRVAR(_imp_extension_suffixes__doc__, -"extension_suffixes($module, /)\n" -"--\n" -"\n" -"Returns the list of file suffixes used to identify extension modules."); - -#define _IMP_EXTENSION_SUFFIXES_METHODDEF \ - {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__}, - -static PyObject * -_imp_extension_suffixes_impl(PyObject *module); - -static PyObject * -_imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_extension_suffixes_impl(module); -} - -PyDoc_STRVAR(_imp_init_frozen__doc__, -"init_frozen($module, name, /)\n" -"--\n" -"\n" -"Initializes a frozen module."); - -#define _IMP_INIT_FROZEN_METHODDEF \ - {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__}, - -static PyObject * -_imp_init_frozen_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_init_frozen(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - + return_value = _imp__fix_co_filename_impl(module, code, path); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_create_builtin__doc__, +"create_builtin($module, spec, /)\n" +"--\n" +"\n" +"Create an extension module."); + +#define _IMP_CREATE_BUILTIN_METHODDEF \ + {"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__}, + +PyDoc_STRVAR(_imp_extension_suffixes__doc__, +"extension_suffixes($module, /)\n" +"--\n" +"\n" +"Returns the list of file suffixes used to identify extension modules."); + +#define _IMP_EXTENSION_SUFFIXES_METHODDEF \ + {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__}, + +static PyObject * +_imp_extension_suffixes_impl(PyObject *module); + +static PyObject * +_imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _imp_extension_suffixes_impl(module); +} + +PyDoc_STRVAR(_imp_init_frozen__doc__, +"init_frozen($module, name, /)\n" +"--\n" +"\n" +"Initializes a frozen module."); + +#define _IMP_INIT_FROZEN_METHODDEF \ + {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__}, + +static PyObject * +_imp_init_frozen_impl(PyObject *module, PyObject *name); + +static PyObject * +_imp_init_frozen(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *name; + if (!PyUnicode_Check(arg)) { _PyArg_BadArgument("init_frozen", "argument", "str", arg); - goto exit; - } + goto exit; + } if (PyUnicode_READY(arg) == -1) { goto exit; } name = arg; - return_value = _imp_init_frozen_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_get_frozen_object__doc__, -"get_frozen_object($module, name, /)\n" -"--\n" -"\n" -"Create a code object for a frozen module."); - -#define _IMP_GET_FROZEN_OBJECT_METHODDEF \ - {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__}, - -static PyObject * -_imp_get_frozen_object_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_get_frozen_object(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - + return_value = _imp_init_frozen_impl(module, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_get_frozen_object__doc__, +"get_frozen_object($module, name, /)\n" +"--\n" +"\n" +"Create a code object for a frozen module."); + +#define _IMP_GET_FROZEN_OBJECT_METHODDEF \ + {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__}, + +static PyObject * +_imp_get_frozen_object_impl(PyObject *module, PyObject *name); + +static PyObject * +_imp_get_frozen_object(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *name; + if (!PyUnicode_Check(arg)) { _PyArg_BadArgument("get_frozen_object", "argument", "str", arg); - goto exit; - } + goto exit; + } if (PyUnicode_READY(arg) == -1) { goto exit; } name = arg; - return_value = _imp_get_frozen_object_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_frozen_package__doc__, -"is_frozen_package($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name is of a frozen package."); - -#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ - {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__}, - -static PyObject * -_imp_is_frozen_package_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_frozen_package(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - + return_value = _imp_get_frozen_object_impl(module, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_is_frozen_package__doc__, +"is_frozen_package($module, name, /)\n" +"--\n" +"\n" +"Returns True if the module name is of a frozen package."); + +#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ + {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__}, + +static PyObject * +_imp_is_frozen_package_impl(PyObject *module, PyObject *name); + +static PyObject * +_imp_is_frozen_package(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *name; + if (!PyUnicode_Check(arg)) { _PyArg_BadArgument("is_frozen_package", "argument", "str", arg); - goto exit; - } + goto exit; + } if (PyUnicode_READY(arg) == -1) { goto exit; } name = arg; - return_value = _imp_is_frozen_package_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_builtin__doc__, -"is_builtin($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name corresponds to a built-in module."); - -#define _IMP_IS_BUILTIN_METHODDEF \ - {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__}, - -static PyObject * -_imp_is_builtin_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_builtin(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - + return_value = _imp_is_frozen_package_impl(module, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_is_builtin__doc__, +"is_builtin($module, name, /)\n" +"--\n" +"\n" +"Returns True if the module name corresponds to a built-in module."); + +#define _IMP_IS_BUILTIN_METHODDEF \ + {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__}, + +static PyObject * +_imp_is_builtin_impl(PyObject *module, PyObject *name); + +static PyObject * +_imp_is_builtin(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *name; + if (!PyUnicode_Check(arg)) { _PyArg_BadArgument("is_builtin", "argument", "str", arg); - goto exit; - } + goto exit; + } if (PyUnicode_READY(arg) == -1) { goto exit; } name = arg; - return_value = _imp_is_builtin_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_frozen__doc__, -"is_frozen($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name corresponds to a frozen module."); - -#define _IMP_IS_FROZEN_METHODDEF \ - {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__}, - -static PyObject * -_imp_is_frozen_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_frozen(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - + return_value = _imp_is_builtin_impl(module, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_is_frozen__doc__, +"is_frozen($module, name, /)\n" +"--\n" +"\n" +"Returns True if the module name corresponds to a frozen module."); + +#define _IMP_IS_FROZEN_METHODDEF \ + {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__}, + +static PyObject * +_imp_is_frozen_impl(PyObject *module, PyObject *name); + +static PyObject * +_imp_is_frozen(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *name; + if (!PyUnicode_Check(arg)) { _PyArg_BadArgument("is_frozen", "argument", "str", arg); - goto exit; - } + goto exit; + } if (PyUnicode_READY(arg) == -1) { goto exit; } name = arg; - return_value = _imp_is_frozen_impl(module, name); - -exit: - return return_value; -} - -#if defined(HAVE_DYNAMIC_LOADING) - -PyDoc_STRVAR(_imp_create_dynamic__doc__, + return_value = _imp_is_frozen_impl(module, name); + +exit: + return return_value; +} + +#if defined(HAVE_DYNAMIC_LOADING) + +PyDoc_STRVAR(_imp_create_dynamic__doc__, "create_dynamic($module, spec, file=<unrepresentable>, /)\n" -"--\n" -"\n" -"Create an extension module."); - -#define _IMP_CREATE_DYNAMIC_METHODDEF \ +"--\n" +"\n" +"Create an extension module."); + +#define _IMP_CREATE_DYNAMIC_METHODDEF \ {"create_dynamic", (PyCFunction)(void(*)(void))_imp_create_dynamic, METH_FASTCALL, _imp_create_dynamic__doc__}, - -static PyObject * -_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file); - -static PyObject * -_imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *spec; - PyObject *file = NULL; - + +static PyObject * +_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file); + +static PyObject * +_imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *spec; + PyObject *file = NULL; + if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) { - goto exit; - } + goto exit; + } spec = args[0]; if (nargs < 2) { goto skip_optional; } file = args[1]; skip_optional: - return_value = _imp_create_dynamic_impl(module, spec, file); - -exit: - return return_value; -} - -#endif /* defined(HAVE_DYNAMIC_LOADING) */ - -#if defined(HAVE_DYNAMIC_LOADING) - -PyDoc_STRVAR(_imp_exec_dynamic__doc__, -"exec_dynamic($module, mod, /)\n" -"--\n" -"\n" -"Initialize an extension module."); - -#define _IMP_EXEC_DYNAMIC_METHODDEF \ - {"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__}, - -static int -_imp_exec_dynamic_impl(PyObject *module, PyObject *mod); - -static PyObject * -_imp_exec_dynamic(PyObject *module, PyObject *mod) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = _imp_exec_dynamic_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -#endif /* defined(HAVE_DYNAMIC_LOADING) */ - -PyDoc_STRVAR(_imp_exec_builtin__doc__, -"exec_builtin($module, mod, /)\n" -"--\n" -"\n" -"Initialize a built-in module."); - -#define _IMP_EXEC_BUILTIN_METHODDEF \ - {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__}, - -static int -_imp_exec_builtin_impl(PyObject *module, PyObject *mod); - -static PyObject * -_imp_exec_builtin(PyObject *module, PyObject *mod) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = _imp_exec_builtin_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_source_hash__doc__, -"source_hash($module, /, key, source)\n" -"--\n" -"\n"); - -#define _IMP_SOURCE_HASH_METHODDEF \ + return_value = _imp_create_dynamic_impl(module, spec, file); + +exit: + return return_value; +} + +#endif /* defined(HAVE_DYNAMIC_LOADING) */ + +#if defined(HAVE_DYNAMIC_LOADING) + +PyDoc_STRVAR(_imp_exec_dynamic__doc__, +"exec_dynamic($module, mod, /)\n" +"--\n" +"\n" +"Initialize an extension module."); + +#define _IMP_EXEC_DYNAMIC_METHODDEF \ + {"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__}, + +static int +_imp_exec_dynamic_impl(PyObject *module, PyObject *mod); + +static PyObject * +_imp_exec_dynamic(PyObject *module, PyObject *mod) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _imp_exec_dynamic_impl(module, mod); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} + +#endif /* defined(HAVE_DYNAMIC_LOADING) */ + +PyDoc_STRVAR(_imp_exec_builtin__doc__, +"exec_builtin($module, mod, /)\n" +"--\n" +"\n" +"Initialize a built-in module."); + +#define _IMP_EXEC_BUILTIN_METHODDEF \ + {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__}, + +static int +_imp_exec_builtin_impl(PyObject *module, PyObject *mod); + +static PyObject * +_imp_exec_builtin(PyObject *module, PyObject *mod) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _imp_exec_builtin_impl(module, mod); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_imp_source_hash__doc__, +"source_hash($module, /, key, source)\n" +"--\n" +"\n"); + +#define _IMP_SOURCE_HASH_METHODDEF \ {"source_hash", (PyCFunction)(void(*)(void))_imp_source_hash, METH_FASTCALL|METH_KEYWORDS, _imp_source_hash__doc__}, - -static PyObject * -_imp_source_hash_impl(PyObject *module, long key, Py_buffer *source); - -static PyObject * -_imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"key", "source", NULL}; + +static PyObject * +_imp_source_hash_impl(PyObject *module, long key, Py_buffer *source); + +static PyObject * +_imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"key", "source", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "source_hash", 0}; PyObject *argsbuf[2]; - long key; - Py_buffer source = {NULL, NULL}; - + long key; + Py_buffer source = {NULL, NULL}; + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } if (PyFloat_Check(args[0])) { PyErr_SetString(PyExc_TypeError, "integer argument expected, got float" ); @@ -436,22 +436,22 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb _PyArg_BadArgument("source_hash", "argument 'source'", "contiguous buffer", args[1]); goto exit; } - return_value = _imp_source_hash_impl(module, key, &source); - -exit: - /* Cleanup for source */ - if (source.obj) { - PyBuffer_Release(&source); - } - - return return_value; -} - -#ifndef _IMP_CREATE_DYNAMIC_METHODDEF - #define _IMP_CREATE_DYNAMIC_METHODDEF -#endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */ - -#ifndef _IMP_EXEC_DYNAMIC_METHODDEF - #define _IMP_EXEC_DYNAMIC_METHODDEF -#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ + return_value = _imp_source_hash_impl(module, key, &source); + +exit: + /* Cleanup for source */ + if (source.obj) { + PyBuffer_Release(&source); + } + + return return_value; +} + +#ifndef _IMP_CREATE_DYNAMIC_METHODDEF + #define _IMP_CREATE_DYNAMIC_METHODDEF +#endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */ + +#ifndef _IMP_EXEC_DYNAMIC_METHODDEF + #define _IMP_EXEC_DYNAMIC_METHODDEF +#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ /*[clinic end generated code: output=3dc495e9c64d944e input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/marshal.c.h b/contrib/tools/python3/src/Python/clinic/marshal.c.h index e19c5b9303..05d4830c4a 100644 --- a/contrib/tools/python3/src/Python/clinic/marshal.c.h +++ b/contrib/tools/python3/src/Python/clinic/marshal.c.h @@ -1,42 +1,42 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(marshal_dump__doc__, -"dump($module, value, file, version=version, /)\n" -"--\n" -"\n" -"Write the value on the open file.\n" -"\n" -" value\n" -" Must be a supported type.\n" -" file\n" -" Must be a writeable binary file.\n" -" version\n" -" Indicates the data format that dump should use.\n" -"\n" -"If the value has (or contains an object that has) an unsupported type, a\n" -"ValueError exception is raised - but garbage data will also be written\n" -"to the file. The object will not be properly read back by load()."); - -#define MARSHAL_DUMP_METHODDEF \ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(marshal_dump__doc__, +"dump($module, value, file, version=version, /)\n" +"--\n" +"\n" +"Write the value on the open file.\n" +"\n" +" value\n" +" Must be a supported type.\n" +" file\n" +" Must be a writeable binary file.\n" +" version\n" +" Indicates the data format that dump should use.\n" +"\n" +"If the value has (or contains an object that has) an unsupported type, a\n" +"ValueError exception is raised - but garbage data will also be written\n" +"to the file. The object will not be properly read back by load()."); + +#define MARSHAL_DUMP_METHODDEF \ {"dump", (PyCFunction)(void(*)(void))marshal_dump, METH_FASTCALL, marshal_dump__doc__}, - -static PyObject * -marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, - int version); - -static PyObject * -marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - PyObject *file; - int version = Py_MARSHAL_VERSION; - + +static PyObject * +marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, + int version); + +static PyObject * +marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *value; + PyObject *file; + int version = Py_MARSHAL_VERSION; + if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { - goto exit; - } + goto exit; + } value = args[0]; file = args[1]; if (nargs < 3) { @@ -52,61 +52,61 @@ marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) goto exit; } skip_optional: - return_value = marshal_dump_impl(module, value, file, version); - -exit: - return return_value; -} - -PyDoc_STRVAR(marshal_load__doc__, -"load($module, file, /)\n" -"--\n" -"\n" -"Read one value from the open file and return it.\n" -"\n" -" file\n" -" Must be readable binary file.\n" -"\n" -"If no valid value is read (e.g. because the data has a different Python\n" -"version\'s incompatible marshal format), raise EOFError, ValueError or\n" -"TypeError.\n" -"\n" -"Note: If an object containing an unsupported type was marshalled with\n" -"dump(), load() will substitute None for the unmarshallable type."); - -#define MARSHAL_LOAD_METHODDEF \ - {"load", (PyCFunction)marshal_load, METH_O, marshal_load__doc__}, - -PyDoc_STRVAR(marshal_dumps__doc__, -"dumps($module, value, version=version, /)\n" -"--\n" -"\n" -"Return the bytes object that would be written to a file by dump(value, file).\n" -"\n" -" value\n" -" Must be a supported type.\n" -" version\n" -" Indicates the data format that dumps should use.\n" -"\n" -"Raise a ValueError exception if value has (or contains an object that has) an\n" -"unsupported type."); - -#define MARSHAL_DUMPS_METHODDEF \ + return_value = marshal_dump_impl(module, value, file, version); + +exit: + return return_value; +} + +PyDoc_STRVAR(marshal_load__doc__, +"load($module, file, /)\n" +"--\n" +"\n" +"Read one value from the open file and return it.\n" +"\n" +" file\n" +" Must be readable binary file.\n" +"\n" +"If no valid value is read (e.g. because the data has a different Python\n" +"version\'s incompatible marshal format), raise EOFError, ValueError or\n" +"TypeError.\n" +"\n" +"Note: If an object containing an unsupported type was marshalled with\n" +"dump(), load() will substitute None for the unmarshallable type."); + +#define MARSHAL_LOAD_METHODDEF \ + {"load", (PyCFunction)marshal_load, METH_O, marshal_load__doc__}, + +PyDoc_STRVAR(marshal_dumps__doc__, +"dumps($module, value, version=version, /)\n" +"--\n" +"\n" +"Return the bytes object that would be written to a file by dump(value, file).\n" +"\n" +" value\n" +" Must be a supported type.\n" +" version\n" +" Indicates the data format that dumps should use.\n" +"\n" +"Raise a ValueError exception if value has (or contains an object that has) an\n" +"unsupported type."); + +#define MARSHAL_DUMPS_METHODDEF \ {"dumps", (PyCFunction)(void(*)(void))marshal_dumps, METH_FASTCALL, marshal_dumps__doc__}, - -static PyObject * -marshal_dumps_impl(PyObject *module, PyObject *value, int version); - -static PyObject * -marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - int version = Py_MARSHAL_VERSION; - + +static PyObject * +marshal_dumps_impl(PyObject *module, PyObject *value, int version); + +static PyObject * +marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *value; + int version = Py_MARSHAL_VERSION; + if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { - goto exit; - } + goto exit; + } value = args[0]; if (nargs < 2) { goto skip_optional; @@ -121,48 +121,48 @@ marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) goto exit; } skip_optional: - return_value = marshal_dumps_impl(module, value, version); - -exit: - return return_value; -} - -PyDoc_STRVAR(marshal_loads__doc__, -"loads($module, bytes, /)\n" -"--\n" -"\n" -"Convert the bytes-like object to a value.\n" -"\n" -"If no valid value is found, raise EOFError, ValueError or TypeError. Extra\n" -"bytes in the input are ignored."); - -#define MARSHAL_LOADS_METHODDEF \ - {"loads", (PyCFunction)marshal_loads, METH_O, marshal_loads__doc__}, - -static PyObject * -marshal_loads_impl(PyObject *module, Py_buffer *bytes); - -static PyObject * -marshal_loads(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - Py_buffer bytes = {NULL, NULL}; - + return_value = marshal_dumps_impl(module, value, version); + +exit: + return return_value; +} + +PyDoc_STRVAR(marshal_loads__doc__, +"loads($module, bytes, /)\n" +"--\n" +"\n" +"Convert the bytes-like object to a value.\n" +"\n" +"If no valid value is found, raise EOFError, ValueError or TypeError. Extra\n" +"bytes in the input are ignored."); + +#define MARSHAL_LOADS_METHODDEF \ + {"loads", (PyCFunction)marshal_loads, METH_O, marshal_loads__doc__}, + +static PyObject * +marshal_loads_impl(PyObject *module, Py_buffer *bytes); + +static PyObject * +marshal_loads(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_buffer bytes = {NULL, NULL}; + if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) { - goto exit; - } + goto exit; + } if (!PyBuffer_IsContiguous(&bytes, 'C')) { _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg); goto exit; } - return_value = marshal_loads_impl(module, &bytes); - -exit: - /* Cleanup for bytes */ - if (bytes.obj) { - PyBuffer_Release(&bytes); - } - - return return_value; -} + return_value = marshal_loads_impl(module, &bytes); + +exit: + /* Cleanup for bytes */ + if (bytes.obj) { + PyBuffer_Release(&bytes); + } + + return return_value; +} /*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/sysmodule.c.h b/contrib/tools/python3/src/Python/clinic/sysmodule.c.h index cc455f3026..4615ebaab5 100644 --- a/contrib/tools/python3/src/Python/clinic/sysmodule.c.h +++ b/contrib/tools/python3/src/Python/clinic/sysmodule.c.h @@ -1,7 +1,7 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - +/*[clinic input] +preserve +[clinic start generated code]*/ + PyDoc_STRVAR(sys_addaudithook__doc__, "addaudithook($module, /, hook)\n" "--\n" @@ -387,36 +387,36 @@ exit: return return_value; } -PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__, -"set_coroutine_origin_tracking_depth($module, /, depth)\n" -"--\n" -"\n" -"Enable or disable origin tracking for coroutine objects in this thread.\n" -"\n" +PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__, +"set_coroutine_origin_tracking_depth($module, /, depth)\n" +"--\n" +"\n" +"Enable or disable origin tracking for coroutine objects in this thread.\n" +"\n" "Coroutine objects will track \'depth\' frames of traceback information\n" "about where they came from, available in their cr_origin attribute.\n" "\n" "Set a depth of 0 to disable."); - -#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ + +#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ {"set_coroutine_origin_tracking_depth", (PyCFunction)(void(*)(void))sys_set_coroutine_origin_tracking_depth, METH_FASTCALL|METH_KEYWORDS, sys_set_coroutine_origin_tracking_depth__doc__}, - -static PyObject * -sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth); - -static PyObject * -sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"depth", NULL}; + +static PyObject * +sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth); + +static PyObject * +sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"depth", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0}; PyObject *argsbuf[1]; - int depth; - + int depth; + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); if (!args) { - goto exit; - } + goto exit; + } if (PyFloat_Check(args[0])) { PyErr_SetString(PyExc_TypeError, "integer argument expected, got float" ); @@ -426,39 +426,39 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, if (depth == -1 && PyErr_Occurred()) { goto exit; } - return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__, -"get_coroutine_origin_tracking_depth($module, /)\n" -"--\n" -"\n" -"Check status of origin tracking for coroutine objects in this thread."); - -#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ - {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__}, - -static int -sys_get_coroutine_origin_tracking_depth_impl(PyObject *module); - -static PyObject * -sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = sys_get_coroutine_origin_tracking_depth_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} + return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__, +"get_coroutine_origin_tracking_depth($module, /)\n" +"--\n" +"\n" +"Check status of origin tracking for coroutine objects in this thread."); + +#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ + {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__}, + +static int +sys_get_coroutine_origin_tracking_depth_impl(PyObject *module); + +static PyObject * +sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = sys_get_coroutine_origin_tracking_depth_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__, "get_asyncgen_hooks($module, /)\n" diff --git a/contrib/tools/python3/src/Python/clinic/traceback.c.h b/contrib/tools/python3/src/Python/clinic/traceback.c.h index 34a6febb54..04daf2a376 100644 --- a/contrib/tools/python3/src/Python/clinic/traceback.c.h +++ b/contrib/tools/python3/src/Python/clinic/traceback.c.h @@ -1,35 +1,35 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(tb_new__doc__, -"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n" -"--\n" -"\n" -"Create a new traceback object."); - -static PyObject * -tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame, - int tb_lasti, int tb_lineno); - -static PyObject * -tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL}; +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(tb_new__doc__, +"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n" +"--\n" +"\n" +"Create a new traceback object."); + +static PyObject * +tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame, + int tb_lasti, int tb_lineno); + +static PyObject * +tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "TracebackType", 0}; PyObject *argsbuf[4]; PyObject * const *fastargs; Py_ssize_t nargs = PyTuple_GET_SIZE(args); - PyObject *tb_next; - PyFrameObject *tb_frame; - int tb_lasti; - int tb_lineno; - + PyObject *tb_next; + PyFrameObject *tb_frame; + int tb_lasti; + int tb_lineno; + fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf); if (!fastargs) { - goto exit; - } + goto exit; + } tb_next = fastargs[0]; if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) { _PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]); @@ -54,9 +54,9 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) if (tb_lineno == -1 && PyErr_Occurred()) { goto exit; } - return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno); - -exit: - return return_value; -} + return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno); + +exit: + return return_value; +} /*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/ |