diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Python/clinic | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/clinic')
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/_warnings.c.h | 82 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/bltinmodule.c.h | 436 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/context.c.h | 104 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/import.c.h | 152 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/marshal.c.h | 78 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/sysmodule.c.h | 1830 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/traceback.c.h | 62 |
7 files changed, 1372 insertions, 1372 deletions
diff --git a/contrib/tools/python3/src/Python/clinic/_warnings.c.h b/contrib/tools/python3/src/Python/clinic/_warnings.c.h index 67ab0e3d9d..8c07aecfc1 100644 --- a/contrib/tools/python3/src/Python/clinic/_warnings.c.h +++ b/contrib/tools/python3/src/Python/clinic/_warnings.c.h @@ -9,7 +9,7 @@ PyDoc_STRVAR(warnings_warn__doc__, "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__}, + {"warn", (PyCFunction)(void(*)(void))warnings_warn, METH_FASTCALL|METH_KEYWORDS, warnings_warn__doc__}, static PyObject * warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, @@ -20,55 +20,55 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec { 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; + 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; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); + if (!args) { goto exit; } - message = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - category = args[1]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[2]) { - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - stacklevel = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - source = args[3]; -skip_optional_pos: + message = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + if (args[1]) { + category = args[1]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[2]) { + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[2]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + stacklevel = ival; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + source = args[3]; +skip_optional_pos: return_value = warnings_warn_impl(module, message, category, stacklevel, source); exit: return return_value; } -/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/ +/*[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 d15af1f7f3..830e7560f2 100644 --- a/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h +++ b/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h @@ -82,7 +82,7 @@ PyDoc_STRVAR(builtin_format__doc__, "details."); #define BUILTIN_FORMAT_METHODDEF \ - {"format", (PyCFunction)(void(*)(void))builtin_format, METH_FASTCALL, builtin_format__doc__}, + {"format", (PyCFunction)(void(*)(void))builtin_format, METH_FASTCALL, builtin_format__doc__}, static PyObject * builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec); @@ -94,22 +94,22 @@ builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *value; PyObject *format_spec = NULL; - if (!_PyArg_CheckPositional("format", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("format", nargs, 1, 2)) { goto exit; } - value = args[0]; - if (nargs < 2) { - goto skip_optional; - } - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("format", "argument 2", "str", args[1]); - goto exit; - } - if (PyUnicode_READY(args[1]) == -1) { - goto exit; - } - format_spec = args[1]; -skip_optional: + value = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("format", "argument 2", "str", args[1]); + goto exit; + } + if (PyUnicode_READY(args[1]) == -1) { + goto exit; + } + format_spec = args[1]; +skip_optional: return_value = builtin_format_impl(module, value, format_spec); exit: @@ -134,15 +134,15 @@ 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; - } - i = _PyLong_AsInt(arg); - if (i == -1 && PyErr_Occurred()) { + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); goto exit; } + i = _PyLong_AsInt(arg); + if (i == -1 && PyErr_Occurred()) { + goto exit; + } return_value = builtin_chr_impl(module, i); exit: @@ -151,7 +151,7 @@ exit: PyDoc_STRVAR(builtin_compile__doc__, "compile($module, /, source, filename, mode, flags=0,\n" -" dont_inherit=False, optimize=-1, *, _feature_version=-1)\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" @@ -168,110 +168,110 @@ PyDoc_STRVAR(builtin_compile__doc__, "in addition to any features explicitly specified."); #define BUILTIN_COMPILE_METHODDEF \ - {"compile", (PyCFunction)(void(*)(void))builtin_compile, METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__}, + {"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, - int optimize, int feature_version); + 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 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; + 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; - int feature_version = -1; + int feature_version = -1; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 6, 0, argsbuf); - if (!args) { - goto exit; - } - source = args[0]; - if (!PyUnicode_FSDecoder(args[1], &filename)) { - goto exit; - } - if (!PyUnicode_Check(args[2])) { - _PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]); - goto exit; - } - Py_ssize_t mode_length; - mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length); - if (mode == NULL) { - goto exit; - } - if (strlen(mode) != (size_t)mode_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[3]) { - if (PyFloat_Check(args[3])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - flags = _PyLong_AsInt(args[3]); - if (flags == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[4]) { - if (PyFloat_Check(args[4])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - dont_inherit = _PyLong_AsInt(args[4]); - if (dont_inherit == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[5]) { - if (PyFloat_Check(args[5])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - optimize = _PyLong_AsInt(args[5]); - if (optimize == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } -skip_optional_pos: - if (!noptargs) { - goto skip_optional_kwonly; - } - if (PyFloat_Check(args[6])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - feature_version = _PyLong_AsInt(args[6]); - if (feature_version == -1 && PyErr_Occurred()) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 6, 0, argsbuf); + if (!args) { goto exit; } -skip_optional_kwonly: - return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version); + source = args[0]; + if (!PyUnicode_FSDecoder(args[1], &filename)) { + goto exit; + } + if (!PyUnicode_Check(args[2])) { + _PyArg_BadArgument("compile", "argument 'mode'", "str", args[2]); + goto exit; + } + Py_ssize_t mode_length; + mode = PyUnicode_AsUTF8AndSize(args[2], &mode_length); + if (mode == NULL) { + goto exit; + } + if (strlen(mode) != (size_t)mode_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[3]) { + if (PyFloat_Check(args[3])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + flags = _PyLong_AsInt(args[3]); + if (flags == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[4]) { + if (PyFloat_Check(args[4])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + dont_inherit = _PyLong_AsInt(args[4]); + if (dont_inherit == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[5]) { + if (PyFloat_Check(args[5])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + optimize = _PyLong_AsInt(args[5]); + if (optimize == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } +skip_optional_pos: + if (!noptargs) { + goto skip_optional_kwonly; + } + if (PyFloat_Check(args[6])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + feature_version = _PyLong_AsInt(args[6]); + if (feature_version == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_kwonly: + return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version); exit: return return_value; @@ -284,7 +284,7 @@ PyDoc_STRVAR(builtin_divmod__doc__, "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__}, + {"divmod", (PyCFunction)(void(*)(void))builtin_divmod, METH_FASTCALL, builtin_divmod__doc__}, static PyObject * builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y); @@ -296,11 +296,11 @@ builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *x; PyObject *y; - if (!_PyArg_CheckPositional("divmod", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("divmod", nargs, 2, 2)) { goto exit; } - x = args[0]; - y = args[1]; + x = args[0]; + y = args[1]; return_value = builtin_divmod_impl(module, x, y); exit: @@ -320,7 +320,7 @@ PyDoc_STRVAR(builtin_eval__doc__, "If only globals is given, locals defaults to it."); #define BUILTIN_EVAL_METHODDEF \ - {"eval", (PyCFunction)(void(*)(void))builtin_eval, METH_FASTCALL, builtin_eval__doc__}, + {"eval", (PyCFunction)(void(*)(void))builtin_eval, METH_FASTCALL, builtin_eval__doc__}, static PyObject * builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, @@ -334,19 +334,19 @@ builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *globals = Py_None; PyObject *locals = Py_None; - if (!_PyArg_CheckPositional("eval", nargs, 1, 3)) { + if (!_PyArg_CheckPositional("eval", nargs, 1, 3)) { goto exit; } - source = args[0]; - if (nargs < 2) { - goto skip_optional; - } - globals = args[1]; - if (nargs < 3) { - goto skip_optional; - } - locals = args[2]; -skip_optional: + source = args[0]; + if (nargs < 2) { + goto skip_optional; + } + globals = args[1]; + if (nargs < 3) { + goto skip_optional; + } + locals = args[2]; +skip_optional: return_value = builtin_eval_impl(module, source, globals, locals); exit: @@ -366,7 +366,7 @@ PyDoc_STRVAR(builtin_exec__doc__, "If only globals is given, locals defaults to it."); #define BUILTIN_EXEC_METHODDEF \ - {"exec", (PyCFunction)(void(*)(void))builtin_exec, METH_FASTCALL, builtin_exec__doc__}, + {"exec", (PyCFunction)(void(*)(void))builtin_exec, METH_FASTCALL, builtin_exec__doc__}, static PyObject * builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, @@ -380,19 +380,19 @@ builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *globals = Py_None; PyObject *locals = Py_None; - if (!_PyArg_CheckPositional("exec", nargs, 1, 3)) { + if (!_PyArg_CheckPositional("exec", nargs, 1, 3)) { goto exit; } - source = args[0]; - if (nargs < 2) { - goto skip_optional; - } - globals = args[1]; - if (nargs < 3) { - goto skip_optional; - } - locals = args[2]; -skip_optional: + source = args[0]; + if (nargs < 2) { + goto skip_optional; + } + globals = args[1]; + if (nargs < 3) { + goto skip_optional; + } + locals = args[2]; +skip_optional: return_value = builtin_exec_impl(module, source, globals, locals); exit: @@ -429,7 +429,7 @@ PyDoc_STRVAR(builtin_hasattr__doc__, "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__}, + {"hasattr", (PyCFunction)(void(*)(void))builtin_hasattr, METH_FASTCALL, builtin_hasattr__doc__}, static PyObject * builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name); @@ -441,11 +441,11 @@ builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *obj; PyObject *name; - if (!_PyArg_CheckPositional("hasattr", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("hasattr", nargs, 2, 2)) { goto exit; } - obj = args[0]; - name = args[1]; + obj = args[0]; + name = args[1]; return_value = builtin_hasattr_impl(module, obj, name); exit: @@ -473,7 +473,7 @@ PyDoc_STRVAR(builtin_setattr__doc__, "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__}, + {"setattr", (PyCFunction)(void(*)(void))builtin_setattr, METH_FASTCALL, builtin_setattr__doc__}, static PyObject * builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name, @@ -487,12 +487,12 @@ builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *name; PyObject *value; - if (!_PyArg_CheckPositional("setattr", nargs, 3, 3)) { + if (!_PyArg_CheckPositional("setattr", nargs, 3, 3)) { goto exit; } - obj = args[0]; - name = args[1]; - value = args[2]; + obj = args[0]; + name = args[1]; + value = args[2]; return_value = builtin_setattr_impl(module, obj, name, value); exit: @@ -508,7 +508,7 @@ PyDoc_STRVAR(builtin_delattr__doc__, "delattr(x, \'y\') is equivalent to ``del x.y\'\'"); #define BUILTIN_DELATTR_METHODDEF \ - {"delattr", (PyCFunction)(void(*)(void))builtin_delattr, METH_FASTCALL, builtin_delattr__doc__}, + {"delattr", (PyCFunction)(void(*)(void))builtin_delattr, METH_FASTCALL, builtin_delattr__doc__}, static PyObject * builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name); @@ -520,11 +520,11 @@ builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *obj; PyObject *name; - if (!_PyArg_CheckPositional("delattr", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("delattr", nargs, 2, 2)) { goto exit; } - obj = args[0]; - name = args[1]; + obj = args[0]; + name = args[1]; return_value = builtin_delattr_impl(module, obj, name); exit: @@ -608,45 +608,45 @@ PyDoc_STRVAR(builtin_ord__doc__, {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__}, PyDoc_STRVAR(builtin_pow__doc__, -"pow($module, /, base, exp, mod=None)\n" +"pow($module, /, base, exp, mod=None)\n" "--\n" "\n" -"Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments\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 \ - {"pow", (PyCFunction)(void(*)(void))builtin_pow, METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__}, + {"pow", (PyCFunction)(void(*)(void))builtin_pow, METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__}, static PyObject * -builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp, - PyObject *mod); +builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp, + PyObject *mod); static PyObject * -builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +builtin_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"base", "exp", "mod", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "pow", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; - PyObject *base; - PyObject *exp; - PyObject *mod = Py_None; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); - if (!args) { + static const char * const _keywords[] = {"base", "exp", "mod", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "pow", 0}; + PyObject *argsbuf[3]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; + PyObject *base; + PyObject *exp; + PyObject *mod = Py_None; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); + if (!args) { goto exit; } - base = args[0]; - exp = args[1]; - if (!noptargs) { - goto skip_optional_pos; - } - mod = args[2]; -skip_optional_pos: - return_value = builtin_pow_impl(module, base, exp, mod); + base = args[0]; + exp = args[1]; + if (!noptargs) { + goto skip_optional_pos; + } + mod = args[2]; +skip_optional_pos: + return_value = builtin_pow_impl(module, base, exp, mod); exit: return return_value; @@ -665,7 +665,7 @@ PyDoc_STRVAR(builtin_input__doc__, "On *nix systems, readline is used if available."); #define BUILTIN_INPUT_METHODDEF \ - {"input", (PyCFunction)(void(*)(void))builtin_input, METH_FASTCALL, builtin_input__doc__}, + {"input", (PyCFunction)(void(*)(void))builtin_input, METH_FASTCALL, builtin_input__doc__}, static PyObject * builtin_input_impl(PyObject *module, PyObject *prompt); @@ -676,14 +676,14 @@ 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)) { + if (!_PyArg_CheckPositional("input", nargs, 0, 1)) { goto exit; } - if (nargs < 1) { - goto skip_optional; - } - prompt = args[0]; -skip_optional: + if (nargs < 1) { + goto skip_optional; + } + prompt = args[0]; +skip_optional: return_value = builtin_input_impl(module, prompt); exit: @@ -711,7 +711,7 @@ PyDoc_STRVAR(builtin_round__doc__, "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__}, + {"round", (PyCFunction)(void(*)(void))builtin_round, METH_FASTCALL|METH_KEYWORDS, builtin_round__doc__}, static PyObject * builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits); @@ -721,22 +721,22 @@ builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec { 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; + 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 *ndigits = Py_None; + PyObject *ndigits = Py_None; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { goto exit; } - number = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - ndigits = args[1]; -skip_optional_pos: + number = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + ndigits = args[1]; +skip_optional_pos: return_value = builtin_round_impl(module, number, ndigits); exit: @@ -744,7 +744,7 @@ exit: } PyDoc_STRVAR(builtin_sum__doc__, -"sum($module, iterable, /, start=0)\n" +"sum($module, iterable, /, start=0)\n" "--\n" "\n" "Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n" @@ -754,32 +754,32 @@ PyDoc_STRVAR(builtin_sum__doc__, "reject non-numeric types."); #define BUILTIN_SUM_METHODDEF \ - {"sum", (PyCFunction)(void(*)(void))builtin_sum, METH_FASTCALL|METH_KEYWORDS, builtin_sum__doc__}, + {"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 * -builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { 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; + 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; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { goto exit; } - iterable = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - start = args[1]; -skip_optional_pos: + iterable = args[0]; + if (!noptargs) { + goto skip_optional_pos; + } + start = args[1]; +skip_optional_pos: return_value = builtin_sum_impl(module, iterable, start); exit: @@ -797,7 +797,7 @@ PyDoc_STRVAR(builtin_isinstance__doc__, "or ...`` etc."); #define BUILTIN_ISINSTANCE_METHODDEF \ - {"isinstance", (PyCFunction)(void(*)(void))builtin_isinstance, METH_FASTCALL, builtin_isinstance__doc__}, + {"isinstance", (PyCFunction)(void(*)(void))builtin_isinstance, METH_FASTCALL, builtin_isinstance__doc__}, static PyObject * builtin_isinstance_impl(PyObject *module, PyObject *obj, @@ -810,11 +810,11 @@ builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *obj; PyObject *class_or_tuple; - if (!_PyArg_CheckPositional("isinstance", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("isinstance", nargs, 2, 2)) { goto exit; } - obj = args[0]; - class_or_tuple = args[1]; + obj = args[0]; + class_or_tuple = args[1]; return_value = builtin_isinstance_impl(module, obj, class_or_tuple); exit: @@ -832,7 +832,7 @@ PyDoc_STRVAR(builtin_issubclass__doc__, "or ...`` etc."); #define BUILTIN_ISSUBCLASS_METHODDEF \ - {"issubclass", (PyCFunction)(void(*)(void))builtin_issubclass, METH_FASTCALL, builtin_issubclass__doc__}, + {"issubclass", (PyCFunction)(void(*)(void))builtin_issubclass, METH_FASTCALL, builtin_issubclass__doc__}, static PyObject * builtin_issubclass_impl(PyObject *module, PyObject *cls, @@ -845,14 +845,14 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *cls; PyObject *class_or_tuple; - if (!_PyArg_CheckPositional("issubclass", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("issubclass", nargs, 2, 2)) { goto exit; } - cls = args[0]; - class_or_tuple = args[1]; + cls = args[0]; + class_or_tuple = args[1]; return_value = builtin_issubclass_impl(module, cls, class_or_tuple); exit: return return_value; } -/*[clinic end generated code: output=29686a89b739d600 input=a9049054013a1b77]*/ +/*[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 2ac8bf7c0b..4290652e15 100644 --- a/contrib/tools/python3/src/Python/clinic/context.c.h +++ b/contrib/tools/python3/src/Python/clinic/context.c.h @@ -5,14 +5,14 @@ preserve 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."); +"\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 \ - {"get", (PyCFunction)(void(*)(void))_contextvars_Context_get, METH_FASTCALL, _contextvars_Context_get__doc__}, + {"get", (PyCFunction)(void(*)(void))_contextvars_Context_get, METH_FASTCALL, _contextvars_Context_get__doc__}, static PyObject * _contextvars_Context_get_impl(PyContext *self, PyObject *key, @@ -25,15 +25,15 @@ _contextvars_Context_get(PyContext *self, PyObject *const *args, Py_ssize_t narg PyObject *key; PyObject *default_value = Py_None; - if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { goto exit; } - key = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: + 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: @@ -43,10 +43,10 @@ exit: 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)."); +"\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__}, @@ -63,8 +63,8 @@ _contextvars_Context_items(PyContext *self, PyObject *Py_UNUSED(ignored)) PyDoc_STRVAR(_contextvars_Context_keys__doc__, "keys($self, /)\n" "--\n" -"\n" -"Return a list of all variables in the context object."); +"\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__}, @@ -81,8 +81,8 @@ _contextvars_Context_keys(PyContext *self, PyObject *Py_UNUSED(ignored)) PyDoc_STRVAR(_contextvars_Context_values__doc__, "values($self, /)\n" "--\n" -"\n" -"Return a list of all variables\' values in the context object."); +"\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__}, @@ -99,8 +99,8 @@ _contextvars_Context_values(PyContext *self, PyObject *Py_UNUSED(ignored)) PyDoc_STRVAR(_contextvars_Context_copy__doc__, "copy($self, /)\n" "--\n" -"\n" -"Return a shallow copy of the context object."); +"\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__}, @@ -115,19 +115,19 @@ _contextvars_Context_copy(PyContext *self, PyObject *Py_UNUSED(ignored)) } PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, -"get($self, default=<unrepresentable>, /)\n" +"get($self, default=<unrepresentable>, /)\n" "--\n" -"\n" -"Return a value for the context variable for the current context.\n" -"\n" -"If there is no value for the variable in the current context, the method will:\n" -" * return the value of the default argument of the method, if provided; or\n" -" * return the default value for the context variable, if it was created\n" -" with one; or\n" -" * raise a LookupError."); +"\n" +"Return a value for the context variable for the current context.\n" +"\n" +"If there is no value for the variable in the current context, the method will:\n" +" * return the value of the default argument of the method, if provided; or\n" +" * 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 \ - {"get", (PyCFunction)(void(*)(void))_contextvars_ContextVar_get, METH_FASTCALL, _contextvars_ContextVar_get__doc__}, + {"get", (PyCFunction)(void(*)(void))_contextvars_ContextVar_get, METH_FASTCALL, _contextvars_ContextVar_get__doc__}, static PyObject * _contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value); @@ -138,14 +138,14 @@ _contextvars_ContextVar_get(PyContextVar *self, PyObject *const *args, Py_ssize_ PyObject *return_value = NULL; PyObject *default_value = NULL; - if (!_PyArg_CheckPositional("get", nargs, 0, 1)) { + if (!_PyArg_CheckPositional("get", nargs, 0, 1)) { goto exit; } - if (nargs < 1) { - goto skip_optional; - } - default_value = args[0]; -skip_optional: + if (nargs < 1) { + goto skip_optional; + } + default_value = args[0]; +skip_optional: return_value = _contextvars_ContextVar_get_impl(self, default_value); exit: @@ -155,13 +155,13 @@ exit: 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" -"The required value argument is the new value for the context variable.\n" -"\n" -"Returns a Token object that can be used to restore the variable to its previous\n" -"value via the `ContextVar.reset()` method."); +"\n" +"Call to set a new value for the context variable in the current context.\n" +"\n" +"The required value argument is the new value for the context variable.\n" +"\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__}, @@ -169,12 +169,12 @@ PyDoc_STRVAR(_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."); +"\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__}, -/*[clinic end generated code: output=f2e42f34e358e179 input=a9049054013a1b77]*/ +/*[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 e4867f34d4..50f3d415ab 100644 --- a/contrib/tools/python3/src/Python/clinic/import.c.h +++ b/contrib/tools/python3/src/Python/clinic/import.c.h @@ -75,7 +75,7 @@ PyDoc_STRVAR(_imp__fix_co_filename__doc__, " 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__}, + {"_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, @@ -88,22 +88,22 @@ _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyCodeObject *code; PyObject *path; - if (!_PyArg_CheckPositional("_fix_co_filename", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("_fix_co_filename", nargs, 2, 2)) { goto exit; } - if (!PyObject_TypeCheck(args[0], &PyCode_Type)) { - _PyArg_BadArgument("_fix_co_filename", "argument 1", (&PyCode_Type)->tp_name, args[0]); - goto exit; - } - code = (PyCodeObject *)args[0]; - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("_fix_co_filename", "argument 2", "str", args[1]); - goto exit; - } - if (PyUnicode_READY(args[1]) == -1) { - goto exit; - } - path = args[1]; + if (!PyObject_TypeCheck(args[0], &PyCode_Type)) { + _PyArg_BadArgument("_fix_co_filename", "argument 1", (&PyCode_Type)->tp_name, args[0]); + goto exit; + } + code = (PyCodeObject *)args[0]; + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("_fix_co_filename", "argument 2", "str", args[1]); + goto exit; + } + if (PyUnicode_READY(args[1]) == -1) { + goto exit; + } + path = args[1]; return_value = _imp__fix_co_filename_impl(module, code, path); exit: @@ -155,14 +155,14 @@ _imp_init_frozen(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *name; - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("init_frozen", "argument", "str", arg); + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("init_frozen", "argument", "str", arg); goto exit; } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + name = arg; return_value = _imp_init_frozen_impl(module, name); exit: @@ -187,14 +187,14 @@ _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; - } - if (PyUnicode_READY(arg) == -1) { + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("get_frozen_object", "argument", "str", arg); goto exit; } - name = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + name = arg; return_value = _imp_get_frozen_object_impl(module, name); exit: @@ -219,14 +219,14 @@ _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); + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("is_frozen_package", "argument", "str", arg); goto exit; } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + name = arg; return_value = _imp_is_frozen_package_impl(module, name); exit: @@ -251,14 +251,14 @@ _imp_is_builtin(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *name; - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("is_builtin", "argument", "str", arg); + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("is_builtin", "argument", "str", arg); goto exit; } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + name = arg; return_value = _imp_is_builtin_impl(module, name); exit: @@ -283,14 +283,14 @@ _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; - } - if (PyUnicode_READY(arg) == -1) { + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("is_frozen", "argument", "str", arg); goto exit; } - name = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + name = arg; return_value = _imp_is_frozen_impl(module, name); exit: @@ -300,13 +300,13 @@ exit: #if defined(HAVE_DYNAMIC_LOADING) PyDoc_STRVAR(_imp_create_dynamic__doc__, -"create_dynamic($module, spec, file=<unrepresentable>, /)\n" +"create_dynamic($module, spec, file=<unrepresentable>, /)\n" "--\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__}, + {"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); @@ -318,15 +318,15 @@ _imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *spec; PyObject *file = NULL; - if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) { goto exit; } - spec = args[0]; - if (nargs < 2) { - goto skip_optional; - } - file = args[1]; -skip_optional: + spec = args[0]; + if (nargs < 2) { + goto skip_optional; + } + file = args[1]; +skip_optional: return_value = _imp_create_dynamic_impl(module, spec, file); exit: @@ -401,7 +401,7 @@ PyDoc_STRVAR(_imp_source_hash__doc__, "\n"); #define _IMP_SOURCE_HASH_METHODDEF \ - {"source_hash", (PyCFunction)(void(*)(void))_imp_source_hash, METH_FASTCALL|METH_KEYWORDS, _imp_source_hash__doc__}, + {"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); @@ -411,31 +411,31 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb { PyObject *return_value = NULL; static const char * const _keywords[] = {"key", "source", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "source_hash", 0}; - PyObject *argsbuf[2]; + static _PyArg_Parser _parser = {NULL, _keywords, "source_hash", 0}; + PyObject *argsbuf[2]; long key; Py_buffer source = {NULL, NULL}; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - key = PyLong_AsLong(args[0]); - if (key == -1 && PyErr_Occurred()) { - goto exit; - } - if (PyObject_GetBuffer(args[1], &source, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&source, 'C')) { - _PyArg_BadArgument("source_hash", "argument 'source'", "contiguous buffer", args[1]); + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); + if (!args) { goto exit; } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + key = PyLong_AsLong(args[0]); + if (key == -1 && PyErr_Occurred()) { + goto exit; + } + if (PyObject_GetBuffer(args[1], &source, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&source, 'C')) { + _PyArg_BadArgument("source_hash", "argument 'source'", "contiguous buffer", args[1]); + goto exit; + } return_value = _imp_source_hash_impl(module, key, &source); exit: @@ -454,4 +454,4 @@ exit: #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=3dc495e9c64d944e input=a9049054013a1b77]*/ +/*[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 05d4830c4a..9064651287 100644 --- a/contrib/tools/python3/src/Python/clinic/marshal.c.h +++ b/contrib/tools/python3/src/Python/clinic/marshal.c.h @@ -20,7 +20,7 @@ PyDoc_STRVAR(marshal_dump__doc__, "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__}, + {"dump", (PyCFunction)(void(*)(void))marshal_dump, METH_FASTCALL, marshal_dump__doc__}, static PyObject * marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, @@ -34,24 +34,24 @@ marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *file; int version = Py_MARSHAL_VERSION; - if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { + if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { goto exit; } - value = args[0]; - file = args[1]; - if (nargs < 3) { - goto skip_optional; - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - version = _PyLong_AsInt(args[2]); - if (version == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: + value = args[0]; + file = args[1]; + if (nargs < 3) { + goto skip_optional; + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + version = _PyLong_AsInt(args[2]); + if (version == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: return_value = marshal_dump_impl(module, value, file, version); exit: @@ -92,7 +92,7 @@ PyDoc_STRVAR(marshal_dumps__doc__, "unsupported type."); #define MARSHAL_DUMPS_METHODDEF \ - {"dumps", (PyCFunction)(void(*)(void))marshal_dumps, METH_FASTCALL, marshal_dumps__doc__}, + {"dumps", (PyCFunction)(void(*)(void))marshal_dumps, METH_FASTCALL, marshal_dumps__doc__}, static PyObject * marshal_dumps_impl(PyObject *module, PyObject *value, int version); @@ -104,23 +104,23 @@ marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *value; int version = Py_MARSHAL_VERSION; - if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { - goto exit; - } - value = args[0]; - if (nargs < 2) { - goto skip_optional; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - version = _PyLong_AsInt(args[1]); - if (version == -1 && PyErr_Occurred()) { + if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { goto exit; } -skip_optional: + value = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + version = _PyLong_AsInt(args[1]); + if (version == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: return_value = marshal_dumps_impl(module, value, version); exit: @@ -148,13 +148,13 @@ 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; - } - if (!PyBuffer_IsContiguous(&bytes, 'C')) { - _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg); + if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) { goto exit; } + if (!PyBuffer_IsContiguous(&bytes, 'C')) { + _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg); + goto exit; + } return_value = marshal_loads_impl(module, &bytes); exit: @@ -165,4 +165,4 @@ exit: return return_value; } -/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/ +/*[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 4615ebaab5..36943eae35 100644 --- a/contrib/tools/python3/src/Python/clinic/sysmodule.c.h +++ b/contrib/tools/python3/src/Python/clinic/sysmodule.c.h @@ -2,404 +2,404 @@ preserve [clinic start generated code]*/ -PyDoc_STRVAR(sys_addaudithook__doc__, -"addaudithook($module, /, hook)\n" -"--\n" -"\n" -"Adds a new audit hook callback."); - -#define SYS_ADDAUDITHOOK_METHODDEF \ - {"addaudithook", (PyCFunction)(void(*)(void))sys_addaudithook, METH_FASTCALL|METH_KEYWORDS, sys_addaudithook__doc__}, - -static PyObject * -sys_addaudithook_impl(PyObject *module, PyObject *hook); - -static PyObject * -sys_addaudithook(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - static const char * const _keywords[] = {"hook", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "addaudithook", 0}; - PyObject *argsbuf[1]; - PyObject *hook; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - hook = args[0]; - return_value = sys_addaudithook_impl(module, hook); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_displayhook__doc__, -"displayhook($module, object, /)\n" -"--\n" -"\n" -"Print an object to sys.stdout and also save it in builtins._"); - -#define SYS_DISPLAYHOOK_METHODDEF \ - {"displayhook", (PyCFunction)sys_displayhook, METH_O, sys_displayhook__doc__}, - -PyDoc_STRVAR(sys_excepthook__doc__, -"excepthook($module, exctype, value, traceback, /)\n" -"--\n" -"\n" -"Handle an exception by displaying it with a traceback on sys.stderr."); - -#define SYS_EXCEPTHOOK_METHODDEF \ - {"excepthook", (PyCFunction)(void(*)(void))sys_excepthook, METH_FASTCALL, sys_excepthook__doc__}, - -static PyObject * -sys_excepthook_impl(PyObject *module, PyObject *exctype, PyObject *value, - PyObject *traceback); - -static PyObject * -sys_excepthook(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *exctype; - PyObject *value; - PyObject *traceback; - - if (!_PyArg_CheckPositional("excepthook", nargs, 3, 3)) { - goto exit; - } - exctype = args[0]; - value = args[1]; - traceback = args[2]; - return_value = sys_excepthook_impl(module, exctype, value, traceback); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_exc_info__doc__, -"exc_info($module, /)\n" -"--\n" -"\n" -"Return current exception information: (type, value, traceback).\n" -"\n" -"Return information about the most recent exception caught by an except\n" -"clause in the current stack frame or in an older stack frame."); - -#define SYS_EXC_INFO_METHODDEF \ - {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, sys_exc_info__doc__}, - -static PyObject * -sys_exc_info_impl(PyObject *module); - -static PyObject * -sys_exc_info(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_exc_info_impl(module); -} - -PyDoc_STRVAR(sys_unraisablehook__doc__, -"unraisablehook($module, unraisable, /)\n" -"--\n" -"\n" -"Handle an unraisable exception.\n" -"\n" -"The unraisable argument has the following attributes:\n" -"\n" -"* exc_type: Exception type.\n" -"* exc_value: Exception value, can be None.\n" -"* exc_traceback: Exception traceback, can be None.\n" -"* err_msg: Error message, can be None.\n" -"* object: Object causing the exception, can be None."); - -#define SYS_UNRAISABLEHOOK_METHODDEF \ - {"unraisablehook", (PyCFunction)sys_unraisablehook, METH_O, sys_unraisablehook__doc__}, - -PyDoc_STRVAR(sys_exit__doc__, -"exit($module, status=None, /)\n" -"--\n" -"\n" -"Exit the interpreter by raising SystemExit(status).\n" -"\n" -"If the status is omitted or None, it defaults to zero (i.e., success).\n" -"If the status is an integer, it will be used as the system exit status.\n" -"If it is another kind of object, it will be printed and the system\n" -"exit status will be one (i.e., failure)."); - -#define SYS_EXIT_METHODDEF \ - {"exit", (PyCFunction)(void(*)(void))sys_exit, METH_FASTCALL, sys_exit__doc__}, - -static PyObject * -sys_exit_impl(PyObject *module, PyObject *status); - -static PyObject * -sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *status = Py_None; - - if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - status = args[0]; -skip_optional: - return_value = sys_exit_impl(module, status); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_getdefaultencoding__doc__, -"getdefaultencoding($module, /)\n" -"--\n" -"\n" -"Return the current default encoding used by the Unicode implementation."); - -#define SYS_GETDEFAULTENCODING_METHODDEF \ - {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, sys_getdefaultencoding__doc__}, - -static PyObject * -sys_getdefaultencoding_impl(PyObject *module); - -static PyObject * -sys_getdefaultencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getdefaultencoding_impl(module); -} - -PyDoc_STRVAR(sys_getfilesystemencoding__doc__, -"getfilesystemencoding($module, /)\n" -"--\n" -"\n" -"Return the encoding used to convert Unicode filenames to OS filenames."); - -#define SYS_GETFILESYSTEMENCODING_METHODDEF \ - {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, sys_getfilesystemencoding__doc__}, - -static PyObject * -sys_getfilesystemencoding_impl(PyObject *module); - -static PyObject * -sys_getfilesystemencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getfilesystemencoding_impl(module); -} - -PyDoc_STRVAR(sys_getfilesystemencodeerrors__doc__, -"getfilesystemencodeerrors($module, /)\n" -"--\n" -"\n" -"Return the error mode used Unicode to OS filename conversion."); - -#define SYS_GETFILESYSTEMENCODEERRORS_METHODDEF \ - {"getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors, METH_NOARGS, sys_getfilesystemencodeerrors__doc__}, - -static PyObject * -sys_getfilesystemencodeerrors_impl(PyObject *module); - -static PyObject * -sys_getfilesystemencodeerrors(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getfilesystemencodeerrors_impl(module); -} - -PyDoc_STRVAR(sys_intern__doc__, -"intern($module, string, /)\n" -"--\n" -"\n" -"``Intern\'\' the given string.\n" -"\n" -"This enters the string in the (global) table of interned strings whose\n" -"purpose is to speed up dictionary lookups. Return the string itself or\n" -"the previously interned string object with the same value."); - -#define SYS_INTERN_METHODDEF \ - {"intern", (PyCFunction)sys_intern, METH_O, sys_intern__doc__}, - -static PyObject * -sys_intern_impl(PyObject *module, PyObject *s); - -static PyObject * -sys_intern(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *s; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("intern", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - s = arg; - return_value = sys_intern_impl(module, s); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_gettrace__doc__, -"gettrace($module, /)\n" -"--\n" -"\n" -"Return the global debug tracing function set with sys.settrace.\n" -"\n" -"See the debugger chapter in the library manual."); - -#define SYS_GETTRACE_METHODDEF \ - {"gettrace", (PyCFunction)sys_gettrace, METH_NOARGS, sys_gettrace__doc__}, - -static PyObject * -sys_gettrace_impl(PyObject *module); - -static PyObject * -sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_gettrace_impl(module); -} - -PyDoc_STRVAR(sys_getprofile__doc__, -"getprofile($module, /)\n" -"--\n" -"\n" -"Return the profiling function set with sys.setprofile.\n" -"\n" -"See the profiler chapter in the library manual."); - -#define SYS_GETPROFILE_METHODDEF \ - {"getprofile", (PyCFunction)sys_getprofile, METH_NOARGS, sys_getprofile__doc__}, - -static PyObject * -sys_getprofile_impl(PyObject *module); - -static PyObject * -sys_getprofile(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getprofile_impl(module); -} - -PyDoc_STRVAR(sys_setswitchinterval__doc__, -"setswitchinterval($module, interval, /)\n" -"--\n" -"\n" -"Set the ideal thread switching delay inside the Python interpreter.\n" -"\n" -"The actual frequency of switching threads can be lower if the\n" -"interpreter executes long sequences of uninterruptible code\n" -"(this is implementation-specific and workload-dependent).\n" -"\n" -"The parameter must represent the desired switching delay in seconds\n" -"A typical value is 0.005 (5 milliseconds)."); - -#define SYS_SETSWITCHINTERVAL_METHODDEF \ - {"setswitchinterval", (PyCFunction)sys_setswitchinterval, METH_O, sys_setswitchinterval__doc__}, - -static PyObject * -sys_setswitchinterval_impl(PyObject *module, double interval); - -static PyObject * -sys_setswitchinterval(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - double interval; - - if (PyFloat_CheckExact(arg)) { - interval = PyFloat_AS_DOUBLE(arg); - } - else - { - interval = PyFloat_AsDouble(arg); - if (interval == -1.0 && PyErr_Occurred()) { - goto exit; - } - } - return_value = sys_setswitchinterval_impl(module, interval); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_getswitchinterval__doc__, -"getswitchinterval($module, /)\n" -"--\n" -"\n" -"Return the current thread switch interval; see sys.setswitchinterval()."); - -#define SYS_GETSWITCHINTERVAL_METHODDEF \ - {"getswitchinterval", (PyCFunction)sys_getswitchinterval, METH_NOARGS, sys_getswitchinterval__doc__}, - -static double -sys_getswitchinterval_impl(PyObject *module); - -static PyObject * -sys_getswitchinterval(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - double _return_value; - - _return_value = sys_getswitchinterval_impl(module); - if ((_return_value == -1.0) && PyErr_Occurred()) { - goto exit; - } - return_value = PyFloat_FromDouble(_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_setrecursionlimit__doc__, -"setrecursionlimit($module, limit, /)\n" -"--\n" -"\n" -"Set the maximum depth of the Python interpreter stack to n.\n" -"\n" -"This limit prevents infinite recursion from causing an overflow of the C\n" -"stack and crashing Python. The highest possible limit is platform-\n" -"dependent."); - -#define SYS_SETRECURSIONLIMIT_METHODDEF \ - {"setrecursionlimit", (PyCFunction)sys_setrecursionlimit, METH_O, sys_setrecursionlimit__doc__}, - -static PyObject * -sys_setrecursionlimit_impl(PyObject *module, int new_limit); - -static PyObject * -sys_setrecursionlimit(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int new_limit; - - if (PyFloat_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - new_limit = _PyLong_AsInt(arg); - if (new_limit == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = sys_setrecursionlimit_impl(module, new_limit); - -exit: - return return_value; -} - +PyDoc_STRVAR(sys_addaudithook__doc__, +"addaudithook($module, /, hook)\n" +"--\n" +"\n" +"Adds a new audit hook callback."); + +#define SYS_ADDAUDITHOOK_METHODDEF \ + {"addaudithook", (PyCFunction)(void(*)(void))sys_addaudithook, METH_FASTCALL|METH_KEYWORDS, sys_addaudithook__doc__}, + +static PyObject * +sys_addaudithook_impl(PyObject *module, PyObject *hook); + +static PyObject * +sys_addaudithook(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"hook", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "addaudithook", 0}; + PyObject *argsbuf[1]; + PyObject *hook; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { + goto exit; + } + hook = args[0]; + return_value = sys_addaudithook_impl(module, hook); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_displayhook__doc__, +"displayhook($module, object, /)\n" +"--\n" +"\n" +"Print an object to sys.stdout and also save it in builtins._"); + +#define SYS_DISPLAYHOOK_METHODDEF \ + {"displayhook", (PyCFunction)sys_displayhook, METH_O, sys_displayhook__doc__}, + +PyDoc_STRVAR(sys_excepthook__doc__, +"excepthook($module, exctype, value, traceback, /)\n" +"--\n" +"\n" +"Handle an exception by displaying it with a traceback on sys.stderr."); + +#define SYS_EXCEPTHOOK_METHODDEF \ + {"excepthook", (PyCFunction)(void(*)(void))sys_excepthook, METH_FASTCALL, sys_excepthook__doc__}, + +static PyObject * +sys_excepthook_impl(PyObject *module, PyObject *exctype, PyObject *value, + PyObject *traceback); + +static PyObject * +sys_excepthook(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *exctype; + PyObject *value; + PyObject *traceback; + + if (!_PyArg_CheckPositional("excepthook", nargs, 3, 3)) { + goto exit; + } + exctype = args[0]; + value = args[1]; + traceback = args[2]; + return_value = sys_excepthook_impl(module, exctype, value, traceback); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_exc_info__doc__, +"exc_info($module, /)\n" +"--\n" +"\n" +"Return current exception information: (type, value, traceback).\n" +"\n" +"Return information about the most recent exception caught by an except\n" +"clause in the current stack frame or in an older stack frame."); + +#define SYS_EXC_INFO_METHODDEF \ + {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, sys_exc_info__doc__}, + +static PyObject * +sys_exc_info_impl(PyObject *module); + +static PyObject * +sys_exc_info(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_exc_info_impl(module); +} + +PyDoc_STRVAR(sys_unraisablehook__doc__, +"unraisablehook($module, unraisable, /)\n" +"--\n" +"\n" +"Handle an unraisable exception.\n" +"\n" +"The unraisable argument has the following attributes:\n" +"\n" +"* exc_type: Exception type.\n" +"* exc_value: Exception value, can be None.\n" +"* exc_traceback: Exception traceback, can be None.\n" +"* err_msg: Error message, can be None.\n" +"* object: Object causing the exception, can be None."); + +#define SYS_UNRAISABLEHOOK_METHODDEF \ + {"unraisablehook", (PyCFunction)sys_unraisablehook, METH_O, sys_unraisablehook__doc__}, + +PyDoc_STRVAR(sys_exit__doc__, +"exit($module, status=None, /)\n" +"--\n" +"\n" +"Exit the interpreter by raising SystemExit(status).\n" +"\n" +"If the status is omitted or None, it defaults to zero (i.e., success).\n" +"If the status is an integer, it will be used as the system exit status.\n" +"If it is another kind of object, it will be printed and the system\n" +"exit status will be one (i.e., failure)."); + +#define SYS_EXIT_METHODDEF \ + {"exit", (PyCFunction)(void(*)(void))sys_exit, METH_FASTCALL, sys_exit__doc__}, + +static PyObject * +sys_exit_impl(PyObject *module, PyObject *status); + +static PyObject * +sys_exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *status = Py_None; + + if (!_PyArg_CheckPositional("exit", nargs, 0, 1)) { + goto exit; + } + if (nargs < 1) { + goto skip_optional; + } + status = args[0]; +skip_optional: + return_value = sys_exit_impl(module, status); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_getdefaultencoding__doc__, +"getdefaultencoding($module, /)\n" +"--\n" +"\n" +"Return the current default encoding used by the Unicode implementation."); + +#define SYS_GETDEFAULTENCODING_METHODDEF \ + {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, sys_getdefaultencoding__doc__}, + +static PyObject * +sys_getdefaultencoding_impl(PyObject *module); + +static PyObject * +sys_getdefaultencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getdefaultencoding_impl(module); +} + +PyDoc_STRVAR(sys_getfilesystemencoding__doc__, +"getfilesystemencoding($module, /)\n" +"--\n" +"\n" +"Return the encoding used to convert Unicode filenames to OS filenames."); + +#define SYS_GETFILESYSTEMENCODING_METHODDEF \ + {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, sys_getfilesystemencoding__doc__}, + +static PyObject * +sys_getfilesystemencoding_impl(PyObject *module); + +static PyObject * +sys_getfilesystemencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getfilesystemencoding_impl(module); +} + +PyDoc_STRVAR(sys_getfilesystemencodeerrors__doc__, +"getfilesystemencodeerrors($module, /)\n" +"--\n" +"\n" +"Return the error mode used Unicode to OS filename conversion."); + +#define SYS_GETFILESYSTEMENCODEERRORS_METHODDEF \ + {"getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors, METH_NOARGS, sys_getfilesystemencodeerrors__doc__}, + +static PyObject * +sys_getfilesystemencodeerrors_impl(PyObject *module); + +static PyObject * +sys_getfilesystemencodeerrors(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getfilesystemencodeerrors_impl(module); +} + +PyDoc_STRVAR(sys_intern__doc__, +"intern($module, string, /)\n" +"--\n" +"\n" +"``Intern\'\' the given string.\n" +"\n" +"This enters the string in the (global) table of interned strings whose\n" +"purpose is to speed up dictionary lookups. Return the string itself or\n" +"the previously interned string object with the same value."); + +#define SYS_INTERN_METHODDEF \ + {"intern", (PyCFunction)sys_intern, METH_O, sys_intern__doc__}, + +static PyObject * +sys_intern_impl(PyObject *module, PyObject *s); + +static PyObject * +sys_intern(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *s; + + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("intern", "argument", "str", arg); + goto exit; + } + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + s = arg; + return_value = sys_intern_impl(module, s); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_gettrace__doc__, +"gettrace($module, /)\n" +"--\n" +"\n" +"Return the global debug tracing function set with sys.settrace.\n" +"\n" +"See the debugger chapter in the library manual."); + +#define SYS_GETTRACE_METHODDEF \ + {"gettrace", (PyCFunction)sys_gettrace, METH_NOARGS, sys_gettrace__doc__}, + +static PyObject * +sys_gettrace_impl(PyObject *module); + +static PyObject * +sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_gettrace_impl(module); +} + +PyDoc_STRVAR(sys_getprofile__doc__, +"getprofile($module, /)\n" +"--\n" +"\n" +"Return the profiling function set with sys.setprofile.\n" +"\n" +"See the profiler chapter in the library manual."); + +#define SYS_GETPROFILE_METHODDEF \ + {"getprofile", (PyCFunction)sys_getprofile, METH_NOARGS, sys_getprofile__doc__}, + +static PyObject * +sys_getprofile_impl(PyObject *module); + +static PyObject * +sys_getprofile(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getprofile_impl(module); +} + +PyDoc_STRVAR(sys_setswitchinterval__doc__, +"setswitchinterval($module, interval, /)\n" +"--\n" +"\n" +"Set the ideal thread switching delay inside the Python interpreter.\n" +"\n" +"The actual frequency of switching threads can be lower if the\n" +"interpreter executes long sequences of uninterruptible code\n" +"(this is implementation-specific and workload-dependent).\n" +"\n" +"The parameter must represent the desired switching delay in seconds\n" +"A typical value is 0.005 (5 milliseconds)."); + +#define SYS_SETSWITCHINTERVAL_METHODDEF \ + {"setswitchinterval", (PyCFunction)sys_setswitchinterval, METH_O, sys_setswitchinterval__doc__}, + +static PyObject * +sys_setswitchinterval_impl(PyObject *module, double interval); + +static PyObject * +sys_setswitchinterval(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double interval; + + if (PyFloat_CheckExact(arg)) { + interval = PyFloat_AS_DOUBLE(arg); + } + else + { + interval = PyFloat_AsDouble(arg); + if (interval == -1.0 && PyErr_Occurred()) { + goto exit; + } + } + return_value = sys_setswitchinterval_impl(module, interval); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_getswitchinterval__doc__, +"getswitchinterval($module, /)\n" +"--\n" +"\n" +"Return the current thread switch interval; see sys.setswitchinterval()."); + +#define SYS_GETSWITCHINTERVAL_METHODDEF \ + {"getswitchinterval", (PyCFunction)sys_getswitchinterval, METH_NOARGS, sys_getswitchinterval__doc__}, + +static double +sys_getswitchinterval_impl(PyObject *module); + +static PyObject * +sys_getswitchinterval(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + double _return_value; + + _return_value = sys_getswitchinterval_impl(module); + if ((_return_value == -1.0) && PyErr_Occurred()) { + goto exit; + } + return_value = PyFloat_FromDouble(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys_setrecursionlimit__doc__, +"setrecursionlimit($module, limit, /)\n" +"--\n" +"\n" +"Set the maximum depth of the Python interpreter stack to n.\n" +"\n" +"This limit prevents infinite recursion from causing an overflow of the C\n" +"stack and crashing Python. The highest possible limit is platform-\n" +"dependent."); + +#define SYS_SETRECURSIONLIMIT_METHODDEF \ + {"setrecursionlimit", (PyCFunction)sys_setrecursionlimit, METH_O, sys_setrecursionlimit__doc__}, + +static PyObject * +sys_setrecursionlimit_impl(PyObject *module, int new_limit); + +static PyObject * +sys_setrecursionlimit(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int new_limit; + + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + new_limit = _PyLong_AsInt(arg); + if (new_limit == -1 && PyErr_Occurred()) { + goto exit; + } + return_value = sys_setrecursionlimit_impl(module, new_limit); + +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" -"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."); +"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 \ - {"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__}, + {"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); @@ -409,23 +409,23 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, { 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]; + static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0}; + PyObject *argsbuf[1]; int depth; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - depth = _PyLong_AsInt(args[0]); - if (depth == -1 && PyErr_Occurred()) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { goto exit; } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + depth = _PyLong_AsInt(args[0]); + if (depth == -1 && PyErr_Occurred()) { + goto exit; + } return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth); exit: @@ -459,515 +459,515 @@ sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ig exit: return return_value; } - -PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__, -"get_asyncgen_hooks($module, /)\n" -"--\n" -"\n" -"Return the installed asynchronous generators hooks.\n" -"\n" -"This returns a namedtuple of the form (firstiter, finalizer)."); - -#define SYS_GET_ASYNCGEN_HOOKS_METHODDEF \ - {"get_asyncgen_hooks", (PyCFunction)sys_get_asyncgen_hooks, METH_NOARGS, sys_get_asyncgen_hooks__doc__}, - -static PyObject * -sys_get_asyncgen_hooks_impl(PyObject *module); - -static PyObject * -sys_get_asyncgen_hooks(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_get_asyncgen_hooks_impl(module); -} - -PyDoc_STRVAR(sys_getrecursionlimit__doc__, -"getrecursionlimit($module, /)\n" -"--\n" -"\n" -"Return the current value of the recursion limit.\n" -"\n" -"The recursion limit is the maximum depth of the Python interpreter\n" -"stack. This limit prevents infinite recursion from causing an overflow\n" -"of the C stack and crashing Python."); - -#define SYS_GETRECURSIONLIMIT_METHODDEF \ - {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, sys_getrecursionlimit__doc__}, - -static PyObject * -sys_getrecursionlimit_impl(PyObject *module); - -static PyObject * -sys_getrecursionlimit(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getrecursionlimit_impl(module); -} - -#if defined(MS_WINDOWS) - -PyDoc_STRVAR(sys_getwindowsversion__doc__, -"getwindowsversion($module, /)\n" -"--\n" -"\n" -"Return info about the running version of Windows as a named tuple.\n" -"\n" -"The members are named: major, minor, build, platform, service_pack,\n" -"service_pack_major, service_pack_minor, suite_mask, product_type and\n" -"platform_version. For backward compatibility, only the first 5 items\n" -"are available by indexing. All elements are numbers, except\n" -"service_pack and platform_type which are strings, and platform_version\n" -"which is a 3-tuple. Platform is always 2. Product_type may be 1 for a\n" -"workstation, 2 for a domain controller, 3 for a server.\n" -"Platform_version is a 3-tuple containing a version number that is\n" -"intended for identifying the OS rather than feature detection."); - -#define SYS_GETWINDOWSVERSION_METHODDEF \ - {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, sys_getwindowsversion__doc__}, - -static PyObject * -sys_getwindowsversion_impl(PyObject *module); - -static PyObject * -sys_getwindowsversion(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getwindowsversion_impl(module); -} - -#endif /* defined(MS_WINDOWS) */ - -#if defined(MS_WINDOWS) - -PyDoc_STRVAR(sys__enablelegacywindowsfsencoding__doc__, -"_enablelegacywindowsfsencoding($module, /)\n" -"--\n" -"\n" -"Changes the default filesystem encoding to mbcs:replace.\n" -"\n" -"This is done for consistency with earlier versions of Python. See PEP\n" -"529 for more information.\n" -"\n" -"This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING\n" -"environment variable before launching Python."); - -#define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF \ - {"_enablelegacywindowsfsencoding", (PyCFunction)sys__enablelegacywindowsfsencoding, METH_NOARGS, sys__enablelegacywindowsfsencoding__doc__}, - -static PyObject * -sys__enablelegacywindowsfsencoding_impl(PyObject *module); - -static PyObject * -sys__enablelegacywindowsfsencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__enablelegacywindowsfsencoding_impl(module); -} - -#endif /* defined(MS_WINDOWS) */ - -#if defined(HAVE_DLOPEN) - -PyDoc_STRVAR(sys_setdlopenflags__doc__, -"setdlopenflags($module, flags, /)\n" -"--\n" -"\n" -"Set the flags used by the interpreter for dlopen calls.\n" -"\n" -"This is used, for example, when the interpreter loads extension\n" -"modules. Among other things, this will enable a lazy resolving of\n" -"symbols when importing a module, if called as sys.setdlopenflags(0).\n" -"To share symbols across extension modules, call as\n" -"sys.setdlopenflags(os.RTLD_GLOBAL). Symbolic names for the flag\n" -"modules can be found in the os module (RTLD_xxx constants, e.g.\n" -"os.RTLD_LAZY)."); - -#define SYS_SETDLOPENFLAGS_METHODDEF \ - {"setdlopenflags", (PyCFunction)sys_setdlopenflags, METH_O, sys_setdlopenflags__doc__}, - -static PyObject * -sys_setdlopenflags_impl(PyObject *module, int new_val); - -static PyObject * -sys_setdlopenflags(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int new_val; - - if (PyFloat_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - new_val = _PyLong_AsInt(arg); - if (new_val == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = sys_setdlopenflags_impl(module, new_val); - -exit: - return return_value; -} - -#endif /* defined(HAVE_DLOPEN) */ - -#if defined(HAVE_DLOPEN) - -PyDoc_STRVAR(sys_getdlopenflags__doc__, -"getdlopenflags($module, /)\n" -"--\n" -"\n" -"Return the current value of the flags that are used for dlopen calls.\n" -"\n" -"The flag constants are defined in the os module."); - -#define SYS_GETDLOPENFLAGS_METHODDEF \ - {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, sys_getdlopenflags__doc__}, - -static PyObject * -sys_getdlopenflags_impl(PyObject *module); - -static PyObject * -sys_getdlopenflags(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getdlopenflags_impl(module); -} - -#endif /* defined(HAVE_DLOPEN) */ - -#if defined(USE_MALLOPT) - -PyDoc_STRVAR(sys_mdebug__doc__, -"mdebug($module, flag, /)\n" -"--\n" -"\n"); - -#define SYS_MDEBUG_METHODDEF \ - {"mdebug", (PyCFunction)sys_mdebug, METH_O, sys_mdebug__doc__}, - -static PyObject * -sys_mdebug_impl(PyObject *module, int flag); - -static PyObject * -sys_mdebug(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int flag; - - if (PyFloat_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - flag = _PyLong_AsInt(arg); - if (flag == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = sys_mdebug_impl(module, flag); - -exit: - return return_value; -} - -#endif /* defined(USE_MALLOPT) */ - -PyDoc_STRVAR(sys_getrefcount__doc__, -"getrefcount($module, object, /)\n" -"--\n" -"\n" -"Return the reference count of object.\n" -"\n" -"The count returned is generally one higher than you might expect,\n" -"because it includes the (temporary) reference as an argument to\n" -"getrefcount()."); - -#define SYS_GETREFCOUNT_METHODDEF \ - {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, sys_getrefcount__doc__}, - -static Py_ssize_t -sys_getrefcount_impl(PyObject *module, PyObject *object); - -static PyObject * -sys_getrefcount(PyObject *module, PyObject *object) -{ - PyObject *return_value = NULL; - Py_ssize_t _return_value; - - _return_value = sys_getrefcount_impl(module, object); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromSsize_t(_return_value); - -exit: - return return_value; -} - -#if defined(Py_REF_DEBUG) - -PyDoc_STRVAR(sys_gettotalrefcount__doc__, -"gettotalrefcount($module, /)\n" -"--\n" -"\n"); - -#define SYS_GETTOTALREFCOUNT_METHODDEF \ - {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS, sys_gettotalrefcount__doc__}, - -static Py_ssize_t -sys_gettotalrefcount_impl(PyObject *module); - -static PyObject * -sys_gettotalrefcount(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - Py_ssize_t _return_value; - - _return_value = sys_gettotalrefcount_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromSsize_t(_return_value); - -exit: - return return_value; -} - -#endif /* defined(Py_REF_DEBUG) */ - -PyDoc_STRVAR(sys_getallocatedblocks__doc__, -"getallocatedblocks($module, /)\n" -"--\n" -"\n" -"Return the number of memory blocks currently allocated."); - -#define SYS_GETALLOCATEDBLOCKS_METHODDEF \ - {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS, sys_getallocatedblocks__doc__}, - -static Py_ssize_t -sys_getallocatedblocks_impl(PyObject *module); - -static PyObject * -sys_getallocatedblocks(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - Py_ssize_t _return_value; - - _return_value = sys_getallocatedblocks_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromSsize_t(_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys__getframe__doc__, -"_getframe($module, depth=0, /)\n" -"--\n" -"\n" -"Return a frame object from the call stack.\n" -"\n" -"If optional integer depth is given, return the frame object that many\n" -"calls below the top of the stack. If that is deeper than the call\n" -"stack, ValueError is raised. The default for depth is zero, returning\n" -"the frame at the top of the call stack.\n" -"\n" -"This function should be used for internal and specialized purposes\n" -"only."); - -#define SYS__GETFRAME_METHODDEF \ - {"_getframe", (PyCFunction)(void(*)(void))sys__getframe, METH_FASTCALL, sys__getframe__doc__}, - -static PyObject * -sys__getframe_impl(PyObject *module, int depth); - -static PyObject * -sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int depth = 0; - - if (!_PyArg_CheckPositional("_getframe", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - depth = _PyLong_AsInt(args[0]); - if (depth == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: - return_value = sys__getframe_impl(module, depth); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys__current_frames__doc__, -"_current_frames($module, /)\n" -"--\n" -"\n" -"Return a dict mapping each thread\'s thread id to its current stack frame.\n" -"\n" -"This function should be used for specialized purposes only."); - -#define SYS__CURRENT_FRAMES_METHODDEF \ - {"_current_frames", (PyCFunction)sys__current_frames, METH_NOARGS, sys__current_frames__doc__}, - -static PyObject * -sys__current_frames_impl(PyObject *module); - -static PyObject * -sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__current_frames_impl(module); -} - -PyDoc_STRVAR(sys_call_tracing__doc__, -"call_tracing($module, func, args, /)\n" -"--\n" -"\n" -"Call func(*args), while tracing is enabled.\n" -"\n" -"The tracing state is saved, and restored afterwards. This is intended\n" -"to be called from a debugger from a checkpoint, to recursively debug\n" -"some other code."); - -#define SYS_CALL_TRACING_METHODDEF \ - {"call_tracing", (PyCFunction)(void(*)(void))sys_call_tracing, METH_FASTCALL, sys_call_tracing__doc__}, - -static PyObject * -sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs); - -static PyObject * -sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *func; - PyObject *funcargs; - - if (!_PyArg_CheckPositional("call_tracing", nargs, 2, 2)) { - goto exit; - } - func = args[0]; - if (!PyTuple_Check(args[1])) { - _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]); - goto exit; - } - funcargs = args[1]; - return_value = sys_call_tracing_impl(module, func, funcargs); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys__debugmallocstats__doc__, -"_debugmallocstats($module, /)\n" -"--\n" -"\n" -"Print summary info to stderr about the state of pymalloc\'s structures.\n" -"\n" -"In Py_DEBUG mode, also perform some expensive internal consistency\n" -"checks."); - -#define SYS__DEBUGMALLOCSTATS_METHODDEF \ - {"_debugmallocstats", (PyCFunction)sys__debugmallocstats, METH_NOARGS, sys__debugmallocstats__doc__}, - -static PyObject * -sys__debugmallocstats_impl(PyObject *module); - -static PyObject * -sys__debugmallocstats(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__debugmallocstats_impl(module); -} - -PyDoc_STRVAR(sys__clear_type_cache__doc__, -"_clear_type_cache($module, /)\n" -"--\n" -"\n" -"Clear the internal type lookup cache."); - -#define SYS__CLEAR_TYPE_CACHE_METHODDEF \ - {"_clear_type_cache", (PyCFunction)sys__clear_type_cache, METH_NOARGS, sys__clear_type_cache__doc__}, - -static PyObject * -sys__clear_type_cache_impl(PyObject *module); - -static PyObject * -sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__clear_type_cache_impl(module); -} - -PyDoc_STRVAR(sys_is_finalizing__doc__, -"is_finalizing($module, /)\n" -"--\n" -"\n" -"Return True if Python is exiting."); - -#define SYS_IS_FINALIZING_METHODDEF \ - {"is_finalizing", (PyCFunction)sys_is_finalizing, METH_NOARGS, sys_is_finalizing__doc__}, - -static PyObject * -sys_is_finalizing_impl(PyObject *module); - -static PyObject * -sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_is_finalizing_impl(module); -} - -#if defined(ANDROID_API_LEVEL) - -PyDoc_STRVAR(sys_getandroidapilevel__doc__, -"getandroidapilevel($module, /)\n" -"--\n" -"\n" -"Return the build time API version of Android as an integer."); - -#define SYS_GETANDROIDAPILEVEL_METHODDEF \ - {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, sys_getandroidapilevel__doc__}, - -static PyObject * -sys_getandroidapilevel_impl(PyObject *module); - -static PyObject * -sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_getandroidapilevel_impl(module); -} - -#endif /* defined(ANDROID_API_LEVEL) */ - -#ifndef SYS_GETWINDOWSVERSION_METHODDEF - #define SYS_GETWINDOWSVERSION_METHODDEF -#endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */ - -#ifndef SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF - #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF -#endif /* !defined(SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF) */ - -#ifndef SYS_SETDLOPENFLAGS_METHODDEF - #define SYS_SETDLOPENFLAGS_METHODDEF -#endif /* !defined(SYS_SETDLOPENFLAGS_METHODDEF) */ - -#ifndef SYS_GETDLOPENFLAGS_METHODDEF - #define SYS_GETDLOPENFLAGS_METHODDEF -#endif /* !defined(SYS_GETDLOPENFLAGS_METHODDEF) */ - -#ifndef SYS_MDEBUG_METHODDEF - #define SYS_MDEBUG_METHODDEF -#endif /* !defined(SYS_MDEBUG_METHODDEF) */ - -#ifndef SYS_GETTOTALREFCOUNT_METHODDEF - #define SYS_GETTOTALREFCOUNT_METHODDEF -#endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */ - -#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF - #define SYS_GETANDROIDAPILEVEL_METHODDEF -#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__, +"get_asyncgen_hooks($module, /)\n" +"--\n" +"\n" +"Return the installed asynchronous generators hooks.\n" +"\n" +"This returns a namedtuple of the form (firstiter, finalizer)."); + +#define SYS_GET_ASYNCGEN_HOOKS_METHODDEF \ + {"get_asyncgen_hooks", (PyCFunction)sys_get_asyncgen_hooks, METH_NOARGS, sys_get_asyncgen_hooks__doc__}, + +static PyObject * +sys_get_asyncgen_hooks_impl(PyObject *module); + +static PyObject * +sys_get_asyncgen_hooks(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_get_asyncgen_hooks_impl(module); +} + +PyDoc_STRVAR(sys_getrecursionlimit__doc__, +"getrecursionlimit($module, /)\n" +"--\n" +"\n" +"Return the current value of the recursion limit.\n" +"\n" +"The recursion limit is the maximum depth of the Python interpreter\n" +"stack. This limit prevents infinite recursion from causing an overflow\n" +"of the C stack and crashing Python."); + +#define SYS_GETRECURSIONLIMIT_METHODDEF \ + {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, sys_getrecursionlimit__doc__}, + +static PyObject * +sys_getrecursionlimit_impl(PyObject *module); + +static PyObject * +sys_getrecursionlimit(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getrecursionlimit_impl(module); +} + +#if defined(MS_WINDOWS) + +PyDoc_STRVAR(sys_getwindowsversion__doc__, +"getwindowsversion($module, /)\n" +"--\n" +"\n" +"Return info about the running version of Windows as a named tuple.\n" +"\n" +"The members are named: major, minor, build, platform, service_pack,\n" +"service_pack_major, service_pack_minor, suite_mask, product_type and\n" +"platform_version. For backward compatibility, only the first 5 items\n" +"are available by indexing. All elements are numbers, except\n" +"service_pack and platform_type which are strings, and platform_version\n" +"which is a 3-tuple. Platform is always 2. Product_type may be 1 for a\n" +"workstation, 2 for a domain controller, 3 for a server.\n" +"Platform_version is a 3-tuple containing a version number that is\n" +"intended for identifying the OS rather than feature detection."); + +#define SYS_GETWINDOWSVERSION_METHODDEF \ + {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, sys_getwindowsversion__doc__}, + +static PyObject * +sys_getwindowsversion_impl(PyObject *module); + +static PyObject * +sys_getwindowsversion(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getwindowsversion_impl(module); +} + +#endif /* defined(MS_WINDOWS) */ + +#if defined(MS_WINDOWS) + +PyDoc_STRVAR(sys__enablelegacywindowsfsencoding__doc__, +"_enablelegacywindowsfsencoding($module, /)\n" +"--\n" +"\n" +"Changes the default filesystem encoding to mbcs:replace.\n" +"\n" +"This is done for consistency with earlier versions of Python. See PEP\n" +"529 for more information.\n" +"\n" +"This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING\n" +"environment variable before launching Python."); + +#define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF \ + {"_enablelegacywindowsfsencoding", (PyCFunction)sys__enablelegacywindowsfsencoding, METH_NOARGS, sys__enablelegacywindowsfsencoding__doc__}, + +static PyObject * +sys__enablelegacywindowsfsencoding_impl(PyObject *module); + +static PyObject * +sys__enablelegacywindowsfsencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__enablelegacywindowsfsencoding_impl(module); +} + +#endif /* defined(MS_WINDOWS) */ + +#if defined(HAVE_DLOPEN) + +PyDoc_STRVAR(sys_setdlopenflags__doc__, +"setdlopenflags($module, flags, /)\n" +"--\n" +"\n" +"Set the flags used by the interpreter for dlopen calls.\n" +"\n" +"This is used, for example, when the interpreter loads extension\n" +"modules. Among other things, this will enable a lazy resolving of\n" +"symbols when importing a module, if called as sys.setdlopenflags(0).\n" +"To share symbols across extension modules, call as\n" +"sys.setdlopenflags(os.RTLD_GLOBAL). Symbolic names for the flag\n" +"modules can be found in the os module (RTLD_xxx constants, e.g.\n" +"os.RTLD_LAZY)."); + +#define SYS_SETDLOPENFLAGS_METHODDEF \ + {"setdlopenflags", (PyCFunction)sys_setdlopenflags, METH_O, sys_setdlopenflags__doc__}, + +static PyObject * +sys_setdlopenflags_impl(PyObject *module, int new_val); + +static PyObject * +sys_setdlopenflags(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int new_val; + + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + new_val = _PyLong_AsInt(arg); + if (new_val == -1 && PyErr_Occurred()) { + goto exit; + } + return_value = sys_setdlopenflags_impl(module, new_val); + +exit: + return return_value; +} + +#endif /* defined(HAVE_DLOPEN) */ + +#if defined(HAVE_DLOPEN) + +PyDoc_STRVAR(sys_getdlopenflags__doc__, +"getdlopenflags($module, /)\n" +"--\n" +"\n" +"Return the current value of the flags that are used for dlopen calls.\n" +"\n" +"The flag constants are defined in the os module."); + +#define SYS_GETDLOPENFLAGS_METHODDEF \ + {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, sys_getdlopenflags__doc__}, + +static PyObject * +sys_getdlopenflags_impl(PyObject *module); + +static PyObject * +sys_getdlopenflags(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getdlopenflags_impl(module); +} + +#endif /* defined(HAVE_DLOPEN) */ + +#if defined(USE_MALLOPT) + +PyDoc_STRVAR(sys_mdebug__doc__, +"mdebug($module, flag, /)\n" +"--\n" +"\n"); + +#define SYS_MDEBUG_METHODDEF \ + {"mdebug", (PyCFunction)sys_mdebug, METH_O, sys_mdebug__doc__}, + +static PyObject * +sys_mdebug_impl(PyObject *module, int flag); + +static PyObject * +sys_mdebug(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int flag; + + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + flag = _PyLong_AsInt(arg); + if (flag == -1 && PyErr_Occurred()) { + goto exit; + } + return_value = sys_mdebug_impl(module, flag); + +exit: + return return_value; +} + +#endif /* defined(USE_MALLOPT) */ + +PyDoc_STRVAR(sys_getrefcount__doc__, +"getrefcount($module, object, /)\n" +"--\n" +"\n" +"Return the reference count of object.\n" +"\n" +"The count returned is generally one higher than you might expect,\n" +"because it includes the (temporary) reference as an argument to\n" +"getrefcount()."); + +#define SYS_GETREFCOUNT_METHODDEF \ + {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, sys_getrefcount__doc__}, + +static Py_ssize_t +sys_getrefcount_impl(PyObject *module, PyObject *object); + +static PyObject * +sys_getrefcount(PyObject *module, PyObject *object) +{ + PyObject *return_value = NULL; + Py_ssize_t _return_value; + + _return_value = sys_getrefcount_impl(module, object); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +#if defined(Py_REF_DEBUG) + +PyDoc_STRVAR(sys_gettotalrefcount__doc__, +"gettotalrefcount($module, /)\n" +"--\n" +"\n"); + +#define SYS_GETTOTALREFCOUNT_METHODDEF \ + {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS, sys_gettotalrefcount__doc__}, + +static Py_ssize_t +sys_gettotalrefcount_impl(PyObject *module); + +static PyObject * +sys_gettotalrefcount(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + Py_ssize_t _return_value; + + _return_value = sys_gettotalrefcount_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +#endif /* defined(Py_REF_DEBUG) */ + +PyDoc_STRVAR(sys_getallocatedblocks__doc__, +"getallocatedblocks($module, /)\n" +"--\n" +"\n" +"Return the number of memory blocks currently allocated."); + +#define SYS_GETALLOCATEDBLOCKS_METHODDEF \ + {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS, sys_getallocatedblocks__doc__}, + +static Py_ssize_t +sys_getallocatedblocks_impl(PyObject *module); + +static PyObject * +sys_getallocatedblocks(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + Py_ssize_t _return_value; + + _return_value = sys_getallocatedblocks_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys__getframe__doc__, +"_getframe($module, depth=0, /)\n" +"--\n" +"\n" +"Return a frame object from the call stack.\n" +"\n" +"If optional integer depth is given, return the frame object that many\n" +"calls below the top of the stack. If that is deeper than the call\n" +"stack, ValueError is raised. The default for depth is zero, returning\n" +"the frame at the top of the call stack.\n" +"\n" +"This function should be used for internal and specialized purposes\n" +"only."); + +#define SYS__GETFRAME_METHODDEF \ + {"_getframe", (PyCFunction)(void(*)(void))sys__getframe, METH_FASTCALL, sys__getframe__doc__}, + +static PyObject * +sys__getframe_impl(PyObject *module, int depth); + +static PyObject * +sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + int depth = 0; + + if (!_PyArg_CheckPositional("_getframe", nargs, 0, 1)) { + goto exit; + } + if (nargs < 1) { + goto skip_optional; + } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + depth = _PyLong_AsInt(args[0]); + if (depth == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: + return_value = sys__getframe_impl(module, depth); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys__current_frames__doc__, +"_current_frames($module, /)\n" +"--\n" +"\n" +"Return a dict mapping each thread\'s thread id to its current stack frame.\n" +"\n" +"This function should be used for specialized purposes only."); + +#define SYS__CURRENT_FRAMES_METHODDEF \ + {"_current_frames", (PyCFunction)sys__current_frames, METH_NOARGS, sys__current_frames__doc__}, + +static PyObject * +sys__current_frames_impl(PyObject *module); + +static PyObject * +sys__current_frames(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__current_frames_impl(module); +} + +PyDoc_STRVAR(sys_call_tracing__doc__, +"call_tracing($module, func, args, /)\n" +"--\n" +"\n" +"Call func(*args), while tracing is enabled.\n" +"\n" +"The tracing state is saved, and restored afterwards. This is intended\n" +"to be called from a debugger from a checkpoint, to recursively debug\n" +"some other code."); + +#define SYS_CALL_TRACING_METHODDEF \ + {"call_tracing", (PyCFunction)(void(*)(void))sys_call_tracing, METH_FASTCALL, sys_call_tracing__doc__}, + +static PyObject * +sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs); + +static PyObject * +sys_call_tracing(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + PyObject *func; + PyObject *funcargs; + + if (!_PyArg_CheckPositional("call_tracing", nargs, 2, 2)) { + goto exit; + } + func = args[0]; + if (!PyTuple_Check(args[1])) { + _PyArg_BadArgument("call_tracing", "argument 2", "tuple", args[1]); + goto exit; + } + funcargs = args[1]; + return_value = sys_call_tracing_impl(module, func, funcargs); + +exit: + return return_value; +} + +PyDoc_STRVAR(sys__debugmallocstats__doc__, +"_debugmallocstats($module, /)\n" +"--\n" +"\n" +"Print summary info to stderr about the state of pymalloc\'s structures.\n" +"\n" +"In Py_DEBUG mode, also perform some expensive internal consistency\n" +"checks."); + +#define SYS__DEBUGMALLOCSTATS_METHODDEF \ + {"_debugmallocstats", (PyCFunction)sys__debugmallocstats, METH_NOARGS, sys__debugmallocstats__doc__}, + +static PyObject * +sys__debugmallocstats_impl(PyObject *module); + +static PyObject * +sys__debugmallocstats(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__debugmallocstats_impl(module); +} + +PyDoc_STRVAR(sys__clear_type_cache__doc__, +"_clear_type_cache($module, /)\n" +"--\n" +"\n" +"Clear the internal type lookup cache."); + +#define SYS__CLEAR_TYPE_CACHE_METHODDEF \ + {"_clear_type_cache", (PyCFunction)sys__clear_type_cache, METH_NOARGS, sys__clear_type_cache__doc__}, + +static PyObject * +sys__clear_type_cache_impl(PyObject *module); + +static PyObject * +sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__clear_type_cache_impl(module); +} + +PyDoc_STRVAR(sys_is_finalizing__doc__, +"is_finalizing($module, /)\n" +"--\n" +"\n" +"Return True if Python is exiting."); + +#define SYS_IS_FINALIZING_METHODDEF \ + {"is_finalizing", (PyCFunction)sys_is_finalizing, METH_NOARGS, sys_is_finalizing__doc__}, + +static PyObject * +sys_is_finalizing_impl(PyObject *module); + +static PyObject * +sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_is_finalizing_impl(module); +} + +#if defined(ANDROID_API_LEVEL) + +PyDoc_STRVAR(sys_getandroidapilevel__doc__, +"getandroidapilevel($module, /)\n" +"--\n" +"\n" +"Return the build time API version of Android as an integer."); + +#define SYS_GETANDROIDAPILEVEL_METHODDEF \ + {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, sys_getandroidapilevel__doc__}, + +static PyObject * +sys_getandroidapilevel_impl(PyObject *module); + +static PyObject * +sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys_getandroidapilevel_impl(module); +} + +#endif /* defined(ANDROID_API_LEVEL) */ + +#ifndef SYS_GETWINDOWSVERSION_METHODDEF + #define SYS_GETWINDOWSVERSION_METHODDEF +#endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */ + +#ifndef SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF + #define SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF +#endif /* !defined(SYS__ENABLELEGACYWINDOWSFSENCODING_METHODDEF) */ + +#ifndef SYS_SETDLOPENFLAGS_METHODDEF + #define SYS_SETDLOPENFLAGS_METHODDEF +#endif /* !defined(SYS_SETDLOPENFLAGS_METHODDEF) */ + +#ifndef SYS_GETDLOPENFLAGS_METHODDEF + #define SYS_GETDLOPENFLAGS_METHODDEF +#endif /* !defined(SYS_GETDLOPENFLAGS_METHODDEF) */ + +#ifndef SYS_MDEBUG_METHODDEF + #define SYS_MDEBUG_METHODDEF +#endif /* !defined(SYS_MDEBUG_METHODDEF) */ + +#ifndef SYS_GETTOTALREFCOUNT_METHODDEF + #define SYS_GETTOTALREFCOUNT_METHODDEF +#endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */ + +#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF + #define SYS_GETANDROIDAPILEVEL_METHODDEF +#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ +/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/traceback.c.h b/contrib/tools/python3/src/Python/clinic/traceback.c.h index 04daf2a376..0fc5c844eb 100644 --- a/contrib/tools/python3/src/Python/clinic/traceback.c.h +++ b/contrib/tools/python3/src/Python/clinic/traceback.c.h @@ -17,46 +17,46 @@ 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); + 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; - fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf); - if (!fastargs) { - 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]); - goto exit; - } - tb_frame = (PyFrameObject *)fastargs[1]; - if (PyFloat_Check(fastargs[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - tb_lasti = _PyLong_AsInt(fastargs[2]); - if (tb_lasti == -1 && PyErr_Occurred()) { - goto exit; - } - if (PyFloat_Check(fastargs[3])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - tb_lineno = _PyLong_AsInt(fastargs[3]); - if (tb_lineno == -1 && PyErr_Occurred()) { + fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf); + if (!fastargs) { 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]); + goto exit; + } + tb_frame = (PyFrameObject *)fastargs[1]; + if (PyFloat_Check(fastargs[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + tb_lasti = _PyLong_AsInt(fastargs[2]); + if (tb_lasti == -1 && PyErr_Occurred()) { + goto exit; + } + if (PyFloat_Check(fastargs[3])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + tb_lineno = _PyLong_AsInt(fastargs[3]); + 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; } -/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/ |