diff options
author | AlexSm <alex@ydb.tech> | 2024-03-05 10:40:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 12:40:59 +0300 |
commit | 1ac13c847b5358faba44dbb638a828e24369467b (patch) | |
tree | 07672b4dd3604ad3dee540a02c6494cb7d10dc3d /contrib/tools/python3/src/Python/clinic | |
parent | ffcca3e7f7958ddc6487b91d3df8c01054bd0638 (diff) | |
download | ydb-1ac13c847b5358faba44dbb638a828e24369467b.tar.gz |
Library import 16 (#2433)
Co-authored-by: robot-piglet <robot-piglet@yandex-team.com>
Co-authored-by: deshevoy <deshevoy@yandex-team.com>
Co-authored-by: robot-contrib <robot-contrib@yandex-team.com>
Co-authored-by: thegeorg <thegeorg@yandex-team.com>
Co-authored-by: robot-ya-builder <robot-ya-builder@yandex-team.com>
Co-authored-by: svidyuk <svidyuk@yandex-team.com>
Co-authored-by: shadchin <shadchin@yandex-team.com>
Co-authored-by: robot-ratatosk <robot-ratatosk@yandex-team.com>
Co-authored-by: innokentii <innokentii@yandex-team.com>
Co-authored-by: arkady-e1ppa <arkady-e1ppa@yandex-team.com>
Co-authored-by: snermolaev <snermolaev@yandex-team.com>
Co-authored-by: dimdim11 <dimdim11@yandex-team.com>
Co-authored-by: kickbutt <kickbutt@yandex-team.com>
Co-authored-by: abdullinsaid <abdullinsaid@yandex-team.com>
Co-authored-by: korsunandrei <korsunandrei@yandex-team.com>
Co-authored-by: petrk <petrk@yandex-team.com>
Co-authored-by: miroslav2 <miroslav2@yandex-team.com>
Co-authored-by: serjflint <serjflint@yandex-team.com>
Co-authored-by: akhropov <akhropov@yandex-team.com>
Co-authored-by: prettyboy <prettyboy@yandex-team.com>
Co-authored-by: ilikepugs <ilikepugs@yandex-team.com>
Co-authored-by: hiddenpath <hiddenpath@yandex-team.com>
Co-authored-by: mikhnenko <mikhnenko@yandex-team.com>
Co-authored-by: spreis <spreis@yandex-team.com>
Co-authored-by: andreyshspb <andreyshspb@yandex-team.com>
Co-authored-by: dimaandreev <dimaandreev@yandex-team.com>
Co-authored-by: rashid <rashid@yandex-team.com>
Co-authored-by: robot-ydb-importer <robot-ydb-importer@yandex-team.com>
Co-authored-by: r-vetrov <r-vetrov@yandex-team.com>
Co-authored-by: ypodlesov <ypodlesov@yandex-team.com>
Co-authored-by: zaverden <zaverden@yandex-team.com>
Co-authored-by: vpozdyayev <vpozdyayev@yandex-team.com>
Co-authored-by: robot-cozmo <robot-cozmo@yandex-team.com>
Co-authored-by: v-korovin <v-korovin@yandex-team.com>
Co-authored-by: arikon <arikon@yandex-team.com>
Co-authored-by: khoden <khoden@yandex-team.com>
Co-authored-by: psydmm <psydmm@yandex-team.com>
Co-authored-by: robot-javacom <robot-javacom@yandex-team.com>
Co-authored-by: dtorilov <dtorilov@yandex-team.com>
Co-authored-by: sennikovmv <sennikovmv@yandex-team.com>
Co-authored-by: hcpp <hcpp@ydb.tech>
Diffstat (limited to 'contrib/tools/python3/src/Python/clinic')
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/Python-tokenize.c.h | 83 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/_warnings.c.h | 249 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/bltinmodule.c.h | 1412 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/context.c.h | 186 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/import.c.h | 651 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/instrumentation.c.h | 311 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/marshal.c.h | 164 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/sysmodule.c.h | 1418 | ||||
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/traceback.c.h | 81 |
9 files changed, 0 insertions, 4555 deletions
diff --git a/contrib/tools/python3/src/Python/clinic/Python-tokenize.c.h b/contrib/tools/python3/src/Python/clinic/Python-tokenize.c.h deleted file mode 100644 index 28f5075826..0000000000 --- a/contrib/tools/python3/src/Python/clinic/Python-tokenize.c.h +++ /dev/null @@ -1,83 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -static PyObject * -tokenizeriter_new_impl(PyTypeObject *type, PyObject *readline, - int extra_tokens, const char *encoding); - -static PyObject * -tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 2 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(extra_tokens), &_Py_ID(encoding), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"", "extra_tokens", "encoding", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "tokenizeriter", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[3]; - PyObject * const *fastargs; - Py_ssize_t nargs = PyTuple_GET_SIZE(args); - Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 2; - PyObject *readline; - int extra_tokens; - const char *encoding = NULL; - - fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 1, argsbuf); - if (!fastargs) { - goto exit; - } - readline = fastargs[0]; - extra_tokens = PyObject_IsTrue(fastargs[1]); - if (extra_tokens < 0) { - goto exit; - } - if (!noptargs) { - goto skip_optional_kwonly; - } - if (!PyUnicode_Check(fastargs[2])) { - _PyArg_BadArgument("tokenizeriter", "argument 'encoding'", "str", fastargs[2]); - goto exit; - } - Py_ssize_t encoding_length; - encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length); - if (encoding == NULL) { - goto exit; - } - if (strlen(encoding) != (size_t)encoding_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } -skip_optional_kwonly: - return_value = tokenizeriter_new_impl(type, readline, extra_tokens, encoding); - -exit: - return return_value; -} -/*[clinic end generated code: output=48be65a2808bdfa6 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/_warnings.c.h b/contrib/tools/python3/src/Python/clinic/_warnings.c.h deleted file mode 100644 index 432e554af8..0000000000 --- a/contrib/tools/python3/src/Python/clinic/_warnings.c.h +++ /dev/null @@ -1,249 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(warnings_warn__doc__, -"warn($module, /, message, category=None, stacklevel=1, source=None, *,\n" -" skip_file_prefixes=<unrepresentable>)\n" -"--\n" -"\n" -"Issue a warning, or maybe ignore it or raise an exception.\n" -"\n" -" message\n" -" Text of the warning message.\n" -" category\n" -" The Warning category subclass. Defaults to UserWarning.\n" -" stacklevel\n" -" How far up the call stack to make this warning appear. A value of 2 for\n" -" example attributes the warning to the caller of the code calling warn().\n" -" source\n" -" If supplied, the destroyed object which emitted a ResourceWarning\n" -" skip_file_prefixes\n" -" An optional tuple of module filename prefixes indicating frames to skip\n" -" during stacklevel computations for stack frame attribution."); - -#define WARNINGS_WARN_METHODDEF \ - {"warn", _PyCFunction_CAST(warnings_warn), METH_FASTCALL|METH_KEYWORDS, warnings_warn__doc__}, - -static PyObject * -warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, - Py_ssize_t stacklevel, PyObject *source, - PyTupleObject *skip_file_prefixes); - -static PyObject * -warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 5 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(message), &_Py_ID(category), &_Py_ID(stacklevel), &_Py_ID(source), &_Py_ID(skip_file_prefixes), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"message", "category", "stacklevel", "source", "skip_file_prefixes", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "warn", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[5]; - 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; - PyTupleObject *skip_file_prefixes = NULL; - - 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]) { - { - 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; - } - } - if (args[3]) { - source = args[3]; - if (!--noptargs) { - goto skip_optional_pos; - } - } -skip_optional_pos: - if (!noptargs) { - goto skip_optional_kwonly; - } - if (!PyTuple_Check(args[4])) { - _PyArg_BadArgument("warn", "argument 'skip_file_prefixes'", "tuple", args[4]); - goto exit; - } - skip_file_prefixes = (PyTupleObject *)args[4]; -skip_optional_kwonly: - return_value = warnings_warn_impl(module, message, category, stacklevel, source, skip_file_prefixes); - -exit: - return return_value; -} - -PyDoc_STRVAR(warnings_warn_explicit__doc__, -"warn_explicit($module, /, message, category, filename, lineno,\n" -" module=<unrepresentable>, registry=None,\n" -" module_globals=None, source=None)\n" -"--\n" -"\n" -"Issue a warning, or maybe ignore it or raise an exception."); - -#define WARNINGS_WARN_EXPLICIT_METHODDEF \ - {"warn_explicit", _PyCFunction_CAST(warnings_warn_explicit), METH_FASTCALL|METH_KEYWORDS, warnings_warn_explicit__doc__}, - -static PyObject * -warnings_warn_explicit_impl(PyObject *module, PyObject *message, - PyObject *category, PyObject *filename, - int lineno, PyObject *mod, PyObject *registry, - PyObject *module_globals, PyObject *sourceobj); - -static PyObject * -warnings_warn_explicit(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 8 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(message), &_Py_ID(category), &_Py_ID(filename), &_Py_ID(lineno), &_Py_ID(module), &_Py_ID(registry), &_Py_ID(module_globals), &_Py_ID(source), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"message", "category", "filename", "lineno", "module", "registry", "module_globals", "source", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "warn_explicit", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[8]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 4; - PyObject *message; - PyObject *category; - PyObject *filename; - int lineno; - PyObject *mod = NULL; - PyObject *registry = Py_None; - PyObject *module_globals = Py_None; - PyObject *sourceobj = Py_None; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 8, 0, argsbuf); - if (!args) { - goto exit; - } - message = args[0]; - category = args[1]; - if (!PyUnicode_Check(args[2])) { - _PyArg_BadArgument("warn_explicit", "argument 'filename'", "str", args[2]); - goto exit; - } - if (PyUnicode_READY(args[2]) == -1) { - goto exit; - } - filename = args[2]; - lineno = _PyLong_AsInt(args[3]); - if (lineno == -1 && PyErr_Occurred()) { - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[4]) { - mod = args[4]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[5]) { - registry = args[5]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[6]) { - module_globals = args[6]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - sourceobj = args[7]; -skip_optional_pos: - return_value = warnings_warn_explicit_impl(module, message, category, filename, lineno, mod, registry, module_globals, sourceobj); - -exit: - return return_value; -} - -PyDoc_STRVAR(warnings_filters_mutated__doc__, -"_filters_mutated($module, /)\n" -"--\n" -"\n"); - -#define WARNINGS_FILTERS_MUTATED_METHODDEF \ - {"_filters_mutated", (PyCFunction)warnings_filters_mutated, METH_NOARGS, warnings_filters_mutated__doc__}, - -static PyObject * -warnings_filters_mutated_impl(PyObject *module); - -static PyObject * -warnings_filters_mutated(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return warnings_filters_mutated_impl(module); -} -/*[clinic end generated code: output=20429719d7223bdc input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h b/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h deleted file mode 100644 index b77b4a1e4b..0000000000 --- a/contrib/tools/python3/src/Python/clinic/bltinmodule.c.h +++ /dev/null @@ -1,1412 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(builtin___import____doc__, -"__import__($module, /, name, globals=None, locals=None, fromlist=(),\n" -" level=0)\n" -"--\n" -"\n" -"Import a module.\n" -"\n" -"Because this function is meant for use by the Python\n" -"interpreter and not for general use, it is better to use\n" -"importlib.import_module() to programmatically import a module.\n" -"\n" -"The globals argument is only used to determine the context;\n" -"they are not modified. The locals argument is unused. The fromlist\n" -"should be a list of names to emulate ``from name import ...``, or an\n" -"empty list to emulate ``import name``.\n" -"When importing a module from a package, note that __import__(\'A.B\', ...)\n" -"returns package A when fromlist is empty, but its submodule B when\n" -"fromlist is not empty. The level argument is used to determine whether to\n" -"perform absolute or relative imports: 0 is absolute, while a positive number\n" -"is the number of parent directories to search relative to the current module."); - -#define BUILTIN___IMPORT___METHODDEF \ - {"__import__", _PyCFunction_CAST(builtin___import__), METH_FASTCALL|METH_KEYWORDS, builtin___import____doc__}, - -static PyObject * -builtin___import___impl(PyObject *module, PyObject *name, PyObject *globals, - PyObject *locals, PyObject *fromlist, int level); - -static PyObject * -builtin___import__(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 5 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(name), &_Py_ID(globals), &_Py_ID(locals), &_Py_ID(fromlist), &_Py_ID(level), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"name", "globals", "locals", "fromlist", "level", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "__import__", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[5]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *name; - PyObject *globals = NULL; - PyObject *locals = NULL; - PyObject *fromlist = NULL; - int level = 0; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 5, 0, argsbuf); - if (!args) { - goto exit; - } - name = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - globals = args[1]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[2]) { - locals = args[2]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[3]) { - fromlist = args[3]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - level = _PyLong_AsInt(args[4]); - if (level == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: - return_value = builtin___import___impl(module, name, globals, locals, fromlist, level); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_abs__doc__, -"abs($module, x, /)\n" -"--\n" -"\n" -"Return the absolute value of the argument."); - -#define BUILTIN_ABS_METHODDEF \ - {"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__}, - -PyDoc_STRVAR(builtin_all__doc__, -"all($module, iterable, /)\n" -"--\n" -"\n" -"Return True if bool(x) is True for all values x in the iterable.\n" -"\n" -"If the iterable is empty, return True."); - -#define BUILTIN_ALL_METHODDEF \ - {"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__}, - -PyDoc_STRVAR(builtin_any__doc__, -"any($module, iterable, /)\n" -"--\n" -"\n" -"Return True if bool(x) is True for any x in the iterable.\n" -"\n" -"If the iterable is empty, return False."); - -#define BUILTIN_ANY_METHODDEF \ - {"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__}, - -PyDoc_STRVAR(builtin_ascii__doc__, -"ascii($module, obj, /)\n" -"--\n" -"\n" -"Return an ASCII-only representation of an object.\n" -"\n" -"As repr(), return a string containing a printable representation of an\n" -"object, but escape the non-ASCII characters in the string returned by\n" -"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n" -"to that returned by repr() in Python 2."); - -#define BUILTIN_ASCII_METHODDEF \ - {"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__}, - -PyDoc_STRVAR(builtin_bin__doc__, -"bin($module, number, /)\n" -"--\n" -"\n" -"Return the binary representation of an integer.\n" -"\n" -" >>> bin(2796202)\n" -" \'0b1010101010101010101010\'"); - -#define BUILTIN_BIN_METHODDEF \ - {"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__}, - -PyDoc_STRVAR(builtin_callable__doc__, -"callable($module, obj, /)\n" -"--\n" -"\n" -"Return whether the object is callable (i.e., some kind of function).\n" -"\n" -"Note that classes are callable, as are instances of classes with a\n" -"__call__() method."); - -#define BUILTIN_CALLABLE_METHODDEF \ - {"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__}, - -PyDoc_STRVAR(builtin_format__doc__, -"format($module, value, format_spec=\'\', /)\n" -"--\n" -"\n" -"Return type(value).__format__(value, format_spec)\n" -"\n" -"Many built-in types implement format_spec according to the\n" -"Format Specification Mini-language. See help(\'FORMATTING\').\n" -"\n" -"If type(value) does not supply a method named __format__\n" -"and format_spec is empty, then str(value) is returned.\n" -"See also help(\'SPECIALMETHODS\')."); - -#define BUILTIN_FORMAT_METHODDEF \ - {"format", _PyCFunction_CAST(builtin_format), METH_FASTCALL, builtin_format__doc__}, - -static PyObject * -builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec); - -static PyObject * -builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - PyObject *format_spec = NULL; - - 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: - return_value = builtin_format_impl(module, value, format_spec); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_chr__doc__, -"chr($module, i, /)\n" -"--\n" -"\n" -"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); - -#define BUILTIN_CHR_METHODDEF \ - {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__}, - -static PyObject * -builtin_chr_impl(PyObject *module, int i); - -static PyObject * -builtin_chr(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int i; - - i = _PyLong_AsInt(arg); - if (i == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = builtin_chr_impl(module, i); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_compile__doc__, -"compile($module, /, source, filename, mode, flags=0,\n" -" dont_inherit=False, optimize=-1, *, _feature_version=-1)\n" -"--\n" -"\n" -"Compile source into a code object that can be executed by exec() or eval().\n" -"\n" -"The source code may represent a Python module, statement or expression.\n" -"The filename will be used for run-time error messages.\n" -"The mode must be \'exec\' to compile a module, \'single\' to compile a\n" -"single (interactive) statement, or \'eval\' to compile an expression.\n" -"The flags argument, if present, controls which future statements influence\n" -"the compilation of the code.\n" -"The dont_inherit argument, if true, stops the compilation inheriting\n" -"the effects of any future statements in effect in the code calling\n" -"compile; if absent or false these statements do influence the compilation,\n" -"in addition to any features explicitly specified."); - -#define BUILTIN_COMPILE_METHODDEF \ - {"compile", _PyCFunction_CAST(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); - -static PyObject * -builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 7 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(source), &_Py_ID(filename), &_Py_ID(mode), &_Py_ID(flags), &_Py_ID(dont_inherit), &_Py_ID(optimize), &_Py_ID(_feature_version), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", "_feature_version", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "compile", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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; - - 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]) { - flags = _PyLong_AsInt(args[3]); - if (flags == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[4]) { - dont_inherit = PyObject_IsTrue(args[4]); - if (dont_inherit < 0) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[5]) { - 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; - } - 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; -} - -PyDoc_STRVAR(builtin_dir__doc__, -"dir($module, arg=<unrepresentable>, /)\n" -"--\n" -"\n" -"Show attributes of an object.\n" -"\n" -"If called without an argument, return the names in the current scope.\n" -"Else, return an alphabetized list of names comprising (some of) the attributes\n" -"of the given object, and of attributes reachable from it.\n" -"If the object supplies a method named __dir__, it will be used; otherwise\n" -"the default dir() logic is used and returns:\n" -" for a module object: the module\'s attributes.\n" -" for a class object: its attributes, and recursively the attributes\n" -" of its bases.\n" -" for any other object: its attributes, its class\'s attributes, and\n" -" recursively the attributes of its class\'s base classes."); - -#define BUILTIN_DIR_METHODDEF \ - {"dir", _PyCFunction_CAST(builtin_dir), METH_FASTCALL, builtin_dir__doc__}, - -static PyObject * -builtin_dir_impl(PyObject *module, PyObject *arg); - -static PyObject * -builtin_dir(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *arg = NULL; - - if (!_PyArg_CheckPositional("dir", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - arg = args[0]; -skip_optional: - return_value = builtin_dir_impl(module, arg); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_divmod__doc__, -"divmod($module, x, y, /)\n" -"--\n" -"\n" -"Return the tuple (x//y, x%y). Invariant: div*y + mod == x."); - -#define BUILTIN_DIVMOD_METHODDEF \ - {"divmod", _PyCFunction_CAST(builtin_divmod), METH_FASTCALL, builtin_divmod__doc__}, - -static PyObject * -builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y); - -static PyObject * -builtin_divmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *x; - PyObject *y; - - if (!_PyArg_CheckPositional("divmod", nargs, 2, 2)) { - goto exit; - } - x = args[0]; - y = args[1]; - return_value = builtin_divmod_impl(module, x, y); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_eval__doc__, -"eval($module, source, globals=None, locals=None, /)\n" -"--\n" -"\n" -"Evaluate the given source in the context of globals and locals.\n" -"\n" -"The source may be a string representing a Python expression\n" -"or a code object as returned by compile().\n" -"The globals must be a dictionary and locals can be any mapping,\n" -"defaulting to the current globals and locals.\n" -"If only globals is given, locals defaults to it."); - -#define BUILTIN_EVAL_METHODDEF \ - {"eval", _PyCFunction_CAST(builtin_eval), METH_FASTCALL, builtin_eval__doc__}, - -static PyObject * -builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals, - PyObject *locals); - -static PyObject * -builtin_eval(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *source; - PyObject *globals = Py_None; - PyObject *locals = Py_None; - - 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: - return_value = builtin_eval_impl(module, source, globals, locals); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_exec__doc__, -"exec($module, source, globals=None, locals=None, /, *, closure=None)\n" -"--\n" -"\n" -"Execute the given source in the context of globals and locals.\n" -"\n" -"The source may be a string representing one or more Python statements\n" -"or a code object as returned by compile().\n" -"The globals must be a dictionary and locals can be any mapping,\n" -"defaulting to the current globals and locals.\n" -"If only globals is given, locals defaults to it.\n" -"The closure must be a tuple of cellvars, and can only be used\n" -"when source is a code object requiring exactly that many cellvars."); - -#define BUILTIN_EXEC_METHODDEF \ - {"exec", _PyCFunction_CAST(builtin_exec), METH_FASTCALL|METH_KEYWORDS, builtin_exec__doc__}, - -static PyObject * -builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, - PyObject *locals, PyObject *closure); - -static PyObject * -builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(closure), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"", "", "", "closure", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "exec", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[4]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *source; - PyObject *globals = Py_None; - PyObject *locals = Py_None; - PyObject *closure = NULL; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { - goto exit; - } - source = args[0]; - if (nargs < 2) { - goto skip_optional_posonly; - } - noptargs--; - globals = args[1]; - if (nargs < 3) { - goto skip_optional_posonly; - } - noptargs--; - locals = args[2]; -skip_optional_posonly: - if (!noptargs) { - goto skip_optional_kwonly; - } - closure = args[3]; -skip_optional_kwonly: - return_value = builtin_exec_impl(module, source, globals, locals, closure); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_getattr__doc__, -"getattr($module, object, name, default=<unrepresentable>, /)\n" -"--\n" -"\n" -"Get a named attribute from an object.\n" -"\n" -"getattr(x, \'y\') is equivalent to x.y\n" -"When a default argument is given, it is returned when the attribute doesn\'t\n" -"exist; without it, an exception is raised in that case."); - -#define BUILTIN_GETATTR_METHODDEF \ - {"getattr", _PyCFunction_CAST(builtin_getattr), METH_FASTCALL, builtin_getattr__doc__}, - -static PyObject * -builtin_getattr_impl(PyObject *module, PyObject *object, PyObject *name, - PyObject *default_value); - -static PyObject * -builtin_getattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *object; - PyObject *name; - PyObject *default_value = NULL; - - if (!_PyArg_CheckPositional("getattr", nargs, 2, 3)) { - goto exit; - } - object = args[0]; - name = args[1]; - if (nargs < 3) { - goto skip_optional; - } - default_value = args[2]; -skip_optional: - return_value = builtin_getattr_impl(module, object, name, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_globals__doc__, -"globals($module, /)\n" -"--\n" -"\n" -"Return the dictionary containing the current scope\'s global variables.\n" -"\n" -"NOTE: Updates to this dictionary *will* affect name lookups in the current\n" -"global scope and vice-versa."); - -#define BUILTIN_GLOBALS_METHODDEF \ - {"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__}, - -static PyObject * -builtin_globals_impl(PyObject *module); - -static PyObject * -builtin_globals(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return builtin_globals_impl(module); -} - -PyDoc_STRVAR(builtin_hasattr__doc__, -"hasattr($module, obj, name, /)\n" -"--\n" -"\n" -"Return whether the object has an attribute with the given name.\n" -"\n" -"This is done by calling getattr(obj, name) and catching AttributeError."); - -#define BUILTIN_HASATTR_METHODDEF \ - {"hasattr", _PyCFunction_CAST(builtin_hasattr), METH_FASTCALL, builtin_hasattr__doc__}, - -static PyObject * -builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name); - -static PyObject * -builtin_hasattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - - if (!_PyArg_CheckPositional("hasattr", nargs, 2, 2)) { - goto exit; - } - obj = args[0]; - name = args[1]; - return_value = builtin_hasattr_impl(module, obj, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_id__doc__, -"id($module, obj, /)\n" -"--\n" -"\n" -"Return the identity of an object.\n" -"\n" -"This is guaranteed to be unique among simultaneously existing objects.\n" -"(CPython uses the object\'s memory address.)"); - -#define BUILTIN_ID_METHODDEF \ - {"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__}, - -PyDoc_STRVAR(builtin_next__doc__, -"next($module, iterator, default=<unrepresentable>, /)\n" -"--\n" -"\n" -"Return the next item from the iterator.\n" -"\n" -"If default is given and the iterator is exhausted,\n" -"it is returned instead of raising StopIteration."); - -#define BUILTIN_NEXT_METHODDEF \ - {"next", _PyCFunction_CAST(builtin_next), METH_FASTCALL, builtin_next__doc__}, - -static PyObject * -builtin_next_impl(PyObject *module, PyObject *iterator, - PyObject *default_value); - -static PyObject * -builtin_next(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *iterator; - PyObject *default_value = NULL; - - if (!_PyArg_CheckPositional("next", nargs, 1, 2)) { - goto exit; - } - iterator = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: - return_value = builtin_next_impl(module, iterator, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_setattr__doc__, -"setattr($module, obj, name, value, /)\n" -"--\n" -"\n" -"Sets the named attribute on the given object to the specified value.\n" -"\n" -"setattr(x, \'y\', v) is equivalent to ``x.y = v``"); - -#define BUILTIN_SETATTR_METHODDEF \ - {"setattr", _PyCFunction_CAST(builtin_setattr), METH_FASTCALL, builtin_setattr__doc__}, - -static PyObject * -builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name, - PyObject *value); - -static PyObject * -builtin_setattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - PyObject *value; - - if (!_PyArg_CheckPositional("setattr", nargs, 3, 3)) { - goto exit; - } - obj = args[0]; - name = args[1]; - value = args[2]; - return_value = builtin_setattr_impl(module, obj, name, value); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_delattr__doc__, -"delattr($module, obj, name, /)\n" -"--\n" -"\n" -"Deletes the named attribute from the given object.\n" -"\n" -"delattr(x, \'y\') is equivalent to ``del x.y``"); - -#define BUILTIN_DELATTR_METHODDEF \ - {"delattr", _PyCFunction_CAST(builtin_delattr), METH_FASTCALL, builtin_delattr__doc__}, - -static PyObject * -builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name); - -static PyObject * -builtin_delattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *name; - - if (!_PyArg_CheckPositional("delattr", nargs, 2, 2)) { - goto exit; - } - obj = args[0]; - name = args[1]; - return_value = builtin_delattr_impl(module, obj, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_hash__doc__, -"hash($module, obj, /)\n" -"--\n" -"\n" -"Return the hash value for the given object.\n" -"\n" -"Two objects that compare equal must also have the same hash value, but the\n" -"reverse is not necessarily true."); - -#define BUILTIN_HASH_METHODDEF \ - {"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__}, - -PyDoc_STRVAR(builtin_hex__doc__, -"hex($module, number, /)\n" -"--\n" -"\n" -"Return the hexadecimal representation of an integer.\n" -"\n" -" >>> hex(12648430)\n" -" \'0xc0ffee\'"); - -#define BUILTIN_HEX_METHODDEF \ - {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__}, - -PyDoc_STRVAR(builtin_iter__doc__, -"iter($module, object, sentinel=<unrepresentable>, /)\n" -"--\n" -"\n" -"Get an iterator from an object.\n" -"\n" -"In the first form, the argument must supply its own iterator, or be a sequence.\n" -"In the second form, the callable is called until it returns the sentinel."); - -#define BUILTIN_ITER_METHODDEF \ - {"iter", _PyCFunction_CAST(builtin_iter), METH_FASTCALL, builtin_iter__doc__}, - -static PyObject * -builtin_iter_impl(PyObject *module, PyObject *object, PyObject *sentinel); - -static PyObject * -builtin_iter(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *object; - PyObject *sentinel = NULL; - - if (!_PyArg_CheckPositional("iter", nargs, 1, 2)) { - goto exit; - } - object = args[0]; - if (nargs < 2) { - goto skip_optional; - } - sentinel = args[1]; -skip_optional: - return_value = builtin_iter_impl(module, object, sentinel); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_aiter__doc__, -"aiter($module, async_iterable, /)\n" -"--\n" -"\n" -"Return an AsyncIterator for an AsyncIterable object."); - -#define BUILTIN_AITER_METHODDEF \ - {"aiter", (PyCFunction)builtin_aiter, METH_O, builtin_aiter__doc__}, - -PyDoc_STRVAR(builtin_anext__doc__, -"anext($module, aiterator, default=<unrepresentable>, /)\n" -"--\n" -"\n" -"async anext(aiterator[, default])\n" -"\n" -"Return the next item from the async iterator. If default is given and the async\n" -"iterator is exhausted, it is returned instead of raising StopAsyncIteration."); - -#define BUILTIN_ANEXT_METHODDEF \ - {"anext", _PyCFunction_CAST(builtin_anext), METH_FASTCALL, builtin_anext__doc__}, - -static PyObject * -builtin_anext_impl(PyObject *module, PyObject *aiterator, - PyObject *default_value); - -static PyObject * -builtin_anext(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *aiterator; - PyObject *default_value = NULL; - - if (!_PyArg_CheckPositional("anext", nargs, 1, 2)) { - goto exit; - } - aiterator = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: - return_value = builtin_anext_impl(module, aiterator, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_len__doc__, -"len($module, obj, /)\n" -"--\n" -"\n" -"Return the number of items in a container."); - -#define BUILTIN_LEN_METHODDEF \ - {"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__}, - -PyDoc_STRVAR(builtin_locals__doc__, -"locals($module, /)\n" -"--\n" -"\n" -"Return a dictionary containing the current scope\'s local variables.\n" -"\n" -"NOTE: Whether or not updates to this dictionary will affect name lookups in\n" -"the local scope and vice-versa is *implementation dependent* and not\n" -"covered by any backwards compatibility guarantees."); - -#define BUILTIN_LOCALS_METHODDEF \ - {"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__}, - -static PyObject * -builtin_locals_impl(PyObject *module); - -static PyObject * -builtin_locals(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return builtin_locals_impl(module); -} - -PyDoc_STRVAR(builtin_oct__doc__, -"oct($module, number, /)\n" -"--\n" -"\n" -"Return the octal representation of an integer.\n" -"\n" -" >>> oct(342391)\n" -" \'0o1234567\'"); - -#define BUILTIN_OCT_METHODDEF \ - {"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__}, - -PyDoc_STRVAR(builtin_ord__doc__, -"ord($module, c, /)\n" -"--\n" -"\n" -"Return the Unicode code point for a one-character string."); - -#define BUILTIN_ORD_METHODDEF \ - {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__}, - -PyDoc_STRVAR(builtin_pow__doc__, -"pow($module, /, base, exp, mod=None)\n" -"--\n" -"\n" -"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_CAST(builtin_pow), METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__}, - -static PyObject * -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) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 3 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(base), &_Py_ID(exp), &_Py_ID(mod), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"base", "exp", "mod", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "pow", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_print__doc__, -"print($module, /, *args, sep=\' \', end=\'\\n\', file=None, flush=False)\n" -"--\n" -"\n" -"Prints the values to a stream, or to sys.stdout by default.\n" -"\n" -" sep\n" -" string inserted between values, default a space.\n" -" end\n" -" string appended after the last value, default a newline.\n" -" file\n" -" a file-like object (stream); defaults to the current sys.stdout.\n" -" flush\n" -" whether to forcibly flush the stream."); - -#define BUILTIN_PRINT_METHODDEF \ - {"print", _PyCFunction_CAST(builtin_print), METH_FASTCALL|METH_KEYWORDS, builtin_print__doc__}, - -static PyObject * -builtin_print_impl(PyObject *module, PyObject *args, PyObject *sep, - PyObject *end, PyObject *file, int flush); - -static PyObject * -builtin_print(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 4 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(sep), &_Py_ID(end), &_Py_ID(file), &_Py_ID(flush), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"sep", "end", "file", "flush", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "print", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[5]; - Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; - PyObject *__clinic_args = NULL; - PyObject *sep = Py_None; - PyObject *end = Py_None; - PyObject *file = Py_None; - int flush = 0; - - args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, 0, argsbuf); - if (!args) { - goto exit; - } - __clinic_args = args[0]; - if (!noptargs) { - goto skip_optional_kwonly; - } - if (args[1]) { - sep = args[1]; - if (!--noptargs) { - goto skip_optional_kwonly; - } - } - if (args[2]) { - end = args[2]; - if (!--noptargs) { - goto skip_optional_kwonly; - } - } - if (args[3]) { - file = args[3]; - if (!--noptargs) { - goto skip_optional_kwonly; - } - } - flush = PyObject_IsTrue(args[4]); - if (flush < 0) { - goto exit; - } -skip_optional_kwonly: - return_value = builtin_print_impl(module, __clinic_args, sep, end, file, flush); - -exit: - Py_XDECREF(__clinic_args); - return return_value; -} - -PyDoc_STRVAR(builtin_input__doc__, -"input($module, prompt=\'\', /)\n" -"--\n" -"\n" -"Read a string from standard input. The trailing newline is stripped.\n" -"\n" -"The prompt string, if given, is printed to standard output without a\n" -"trailing newline before reading input.\n" -"\n" -"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n" -"On *nix systems, readline is used if available."); - -#define BUILTIN_INPUT_METHODDEF \ - {"input", _PyCFunction_CAST(builtin_input), METH_FASTCALL, builtin_input__doc__}, - -static PyObject * -builtin_input_impl(PyObject *module, PyObject *prompt); - -static PyObject * -builtin_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *prompt = NULL; - - if (!_PyArg_CheckPositional("input", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - prompt = args[0]; -skip_optional: - return_value = builtin_input_impl(module, prompt); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_repr__doc__, -"repr($module, obj, /)\n" -"--\n" -"\n" -"Return the canonical string representation of the object.\n" -"\n" -"For many object types, including most builtins, eval(repr(obj)) == obj."); - -#define BUILTIN_REPR_METHODDEF \ - {"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__}, - -PyDoc_STRVAR(builtin_round__doc__, -"round($module, /, number, ndigits=None)\n" -"--\n" -"\n" -"Round a number to a given precision in decimal digits.\n" -"\n" -"The return value is an integer if ndigits is omitted or None. Otherwise\n" -"the return value has the same type as the number. ndigits may be negative."); - -#define BUILTIN_ROUND_METHODDEF \ - {"round", _PyCFunction_CAST(builtin_round), METH_FASTCALL|METH_KEYWORDS, builtin_round__doc__}, - -static PyObject * -builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits); - -static PyObject * -builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 2 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(number), &_Py_ID(ndigits), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"number", "ndigits", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "round", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *number; - PyObject *ndigits = Py_None; - - 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: - return_value = builtin_round_impl(module, number, ndigits); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_vars__doc__, -"vars($module, object=<unrepresentable>, /)\n" -"--\n" -"\n" -"Show vars.\n" -"\n" -"Without arguments, equivalent to locals().\n" -"With an argument, equivalent to object.__dict__."); - -#define BUILTIN_VARS_METHODDEF \ - {"vars", _PyCFunction_CAST(builtin_vars), METH_FASTCALL, builtin_vars__doc__}, - -static PyObject * -builtin_vars_impl(PyObject *module, PyObject *object); - -static PyObject * -builtin_vars(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *object = NULL; - - if (!_PyArg_CheckPositional("vars", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - object = args[0]; -skip_optional: - return_value = builtin_vars_impl(module, object); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_sum__doc__, -"sum($module, iterable, /, start=0)\n" -"--\n" -"\n" -"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n" -"\n" -"When the iterable is empty, return the start value.\n" -"This function is intended specifically for use with numeric values and may\n" -"reject non-numeric types."); - -#define BUILTIN_SUM_METHODDEF \ - {"sum", _PyCFunction_CAST(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) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(start), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"", "start", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "sum", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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) { - goto exit; - } - iterable = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - start = args[1]; -skip_optional_pos: - return_value = builtin_sum_impl(module, iterable, start); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_isinstance__doc__, -"isinstance($module, obj, class_or_tuple, /)\n" -"--\n" -"\n" -"Return whether an object is an instance of a class or of a subclass thereof.\n" -"\n" -"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n" -"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n" -"or ...`` etc."); - -#define BUILTIN_ISINSTANCE_METHODDEF \ - {"isinstance", _PyCFunction_CAST(builtin_isinstance), METH_FASTCALL, builtin_isinstance__doc__}, - -static PyObject * -builtin_isinstance_impl(PyObject *module, PyObject *obj, - PyObject *class_or_tuple); - -static PyObject * -builtin_isinstance(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *obj; - PyObject *class_or_tuple; - - if (!_PyArg_CheckPositional("isinstance", nargs, 2, 2)) { - goto exit; - } - obj = args[0]; - class_or_tuple = args[1]; - return_value = builtin_isinstance_impl(module, obj, class_or_tuple); - -exit: - return return_value; -} - -PyDoc_STRVAR(builtin_issubclass__doc__, -"issubclass($module, cls, class_or_tuple, /)\n" -"--\n" -"\n" -"Return whether \'cls\' is derived from another class or is the same class.\n" -"\n" -"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n" -"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n" -"or ...``."); - -#define BUILTIN_ISSUBCLASS_METHODDEF \ - {"issubclass", _PyCFunction_CAST(builtin_issubclass), METH_FASTCALL, builtin_issubclass__doc__}, - -static PyObject * -builtin_issubclass_impl(PyObject *module, PyObject *cls, - PyObject *class_or_tuple); - -static PyObject * -builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *cls; - PyObject *class_or_tuple; - - if (!_PyArg_CheckPositional("issubclass", nargs, 2, 2)) { - goto exit; - } - 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=84a04e7446debf58 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/context.c.h b/contrib/tools/python3/src/Python/clinic/context.c.h deleted file mode 100644 index 27c375717b..0000000000 --- a/contrib/tools/python3/src/Python/clinic/context.c.h +++ /dev/null @@ -1,186 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(_contextvars_Context_get__doc__, -"get($self, key, default=None, /)\n" -"--\n" -"\n" -"Return the value for `key` if `key` has the value in the context object.\n" -"\n" -"If `key` does not exist, return `default`. If `default` is not given,\n" -"return None."); - -#define _CONTEXTVARS_CONTEXT_GET_METHODDEF \ - {"get", _PyCFunction_CAST(_contextvars_Context_get), METH_FASTCALL, _contextvars_Context_get__doc__}, - -static PyObject * -_contextvars_Context_get_impl(PyContext *self, PyObject *key, - PyObject *default_value); - -static PyObject * -_contextvars_Context_get(PyContext *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *key; - PyObject *default_value = Py_None; - - if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { - goto exit; - } - key = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: - return_value = _contextvars_Context_get_impl(self, key, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_contextvars_Context_items__doc__, -"items($self, /)\n" -"--\n" -"\n" -"Return all variables and their values in the context object.\n" -"\n" -"The result is returned as a list of 2-tuples (variable, value)."); - -#define _CONTEXTVARS_CONTEXT_ITEMS_METHODDEF \ - {"items", (PyCFunction)_contextvars_Context_items, METH_NOARGS, _contextvars_Context_items__doc__}, - -static PyObject * -_contextvars_Context_items_impl(PyContext *self); - -static PyObject * -_contextvars_Context_items(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_items_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_keys__doc__, -"keys($self, /)\n" -"--\n" -"\n" -"Return a list of all variables in the context object."); - -#define _CONTEXTVARS_CONTEXT_KEYS_METHODDEF \ - {"keys", (PyCFunction)_contextvars_Context_keys, METH_NOARGS, _contextvars_Context_keys__doc__}, - -static PyObject * -_contextvars_Context_keys_impl(PyContext *self); - -static PyObject * -_contextvars_Context_keys(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_keys_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_values__doc__, -"values($self, /)\n" -"--\n" -"\n" -"Return a list of all variables\' values in the context object."); - -#define _CONTEXTVARS_CONTEXT_VALUES_METHODDEF \ - {"values", (PyCFunction)_contextvars_Context_values, METH_NOARGS, _contextvars_Context_values__doc__}, - -static PyObject * -_contextvars_Context_values_impl(PyContext *self); - -static PyObject * -_contextvars_Context_values(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_values_impl(self); -} - -PyDoc_STRVAR(_contextvars_Context_copy__doc__, -"copy($self, /)\n" -"--\n" -"\n" -"Return a shallow copy of the context object."); - -#define _CONTEXTVARS_CONTEXT_COPY_METHODDEF \ - {"copy", (PyCFunction)_contextvars_Context_copy, METH_NOARGS, _contextvars_Context_copy__doc__}, - -static PyObject * -_contextvars_Context_copy_impl(PyContext *self); - -static PyObject * -_contextvars_Context_copy(PyContext *self, PyObject *Py_UNUSED(ignored)) -{ - return _contextvars_Context_copy_impl(self); -} - -PyDoc_STRVAR(_contextvars_ContextVar_get__doc__, -"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."); - -#define _CONTEXTVARS_CONTEXTVAR_GET_METHODDEF \ - {"get", _PyCFunction_CAST(_contextvars_ContextVar_get), METH_FASTCALL, _contextvars_ContextVar_get__doc__}, - -static PyObject * -_contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value); - -static PyObject * -_contextvars_ContextVar_get(PyContextVar *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *default_value = NULL; - - if (!_PyArg_CheckPositional("get", nargs, 0, 1)) { - goto exit; - } - if (nargs < 1) { - goto skip_optional; - } - default_value = args[0]; -skip_optional: - return_value = _contextvars_ContextVar_get_impl(self, default_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_contextvars_ContextVar_set__doc__, -"set($self, value, /)\n" -"--\n" -"\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__}, - -PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__, -"reset($self, token, /)\n" -"--\n" -"\n" -"Reset the context variable.\n" -"\n" -"The variable is reset to the value it had before the `ContextVar.set()` that\n" -"created the token was used."); - -#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \ - {"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__}, -/*[clinic end generated code: output=0c94d4b919500438 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/import.c.h b/contrib/tools/python3/src/Python/clinic/import.c.h deleted file mode 100644 index cb74be6a42..0000000000 --- a/contrib/tools/python3/src/Python/clinic/import.c.h +++ /dev/null @@ -1,651 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(_imp_lock_held__doc__, -"lock_held($module, /)\n" -"--\n" -"\n" -"Return True if the import lock is currently held, else False.\n" -"\n" -"On platforms without threads, return False."); - -#define _IMP_LOCK_HELD_METHODDEF \ - {"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__}, - -static PyObject * -_imp_lock_held_impl(PyObject *module); - -static PyObject * -_imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_lock_held_impl(module); -} - -PyDoc_STRVAR(_imp_acquire_lock__doc__, -"acquire_lock($module, /)\n" -"--\n" -"\n" -"Acquires the interpreter\'s import lock for the current thread.\n" -"\n" -"This lock should be used by import hooks to ensure thread-safety when importing\n" -"modules. On platforms without threads, this function does nothing."); - -#define _IMP_ACQUIRE_LOCK_METHODDEF \ - {"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__}, - -static PyObject * -_imp_acquire_lock_impl(PyObject *module); - -static PyObject * -_imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_acquire_lock_impl(module); -} - -PyDoc_STRVAR(_imp_release_lock__doc__, -"release_lock($module, /)\n" -"--\n" -"\n" -"Release the interpreter\'s import lock.\n" -"\n" -"On platforms without threads, this function does nothing."); - -#define _IMP_RELEASE_LOCK_METHODDEF \ - {"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__}, - -static PyObject * -_imp_release_lock_impl(PyObject *module); - -static PyObject * -_imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_release_lock_impl(module); -} - -PyDoc_STRVAR(_imp__fix_co_filename__doc__, -"_fix_co_filename($module, code, path, /)\n" -"--\n" -"\n" -"Changes code.co_filename to specify the passed-in file path.\n" -"\n" -" code\n" -" Code object to change.\n" -" path\n" -" File path to use."); - -#define _IMP__FIX_CO_FILENAME_METHODDEF \ - {"_fix_co_filename", _PyCFunction_CAST(_imp__fix_co_filename), METH_FASTCALL, _imp__fix_co_filename__doc__}, - -static PyObject * -_imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code, - PyObject *path); - -static PyObject * -_imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyCodeObject *code; - PyObject *path; - - 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]; - return_value = _imp__fix_co_filename_impl(module, code, path); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_create_builtin__doc__, -"create_builtin($module, spec, /)\n" -"--\n" -"\n" -"Create an extension module."); - -#define _IMP_CREATE_BUILTIN_METHODDEF \ - {"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__}, - -PyDoc_STRVAR(_imp_extension_suffixes__doc__, -"extension_suffixes($module, /)\n" -"--\n" -"\n" -"Returns the list of file suffixes used to identify extension modules."); - -#define _IMP_EXTENSION_SUFFIXES_METHODDEF \ - {"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__}, - -static PyObject * -_imp_extension_suffixes_impl(PyObject *module); - -static PyObject * -_imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp_extension_suffixes_impl(module); -} - -PyDoc_STRVAR(_imp_init_frozen__doc__, -"init_frozen($module, name, /)\n" -"--\n" -"\n" -"Initializes a frozen module."); - -#define _IMP_INIT_FROZEN_METHODDEF \ - {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__}, - -static PyObject * -_imp_init_frozen_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_init_frozen(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("init_frozen", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; - return_value = _imp_init_frozen_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_find_frozen__doc__, -"find_frozen($module, name, /, *, withdata=False)\n" -"--\n" -"\n" -"Return info about the corresponding frozen module (if there is one) or None.\n" -"\n" -"The returned info (a 2-tuple):\n" -"\n" -" * data the raw marshalled bytes\n" -" * is_package whether or not it is a package\n" -" * origname the originally frozen module\'s name, or None if not\n" -" a stdlib module (this will usually be the same as\n" -" the module\'s current name)"); - -#define _IMP_FIND_FROZEN_METHODDEF \ - {"find_frozen", _PyCFunction_CAST(_imp_find_frozen), METH_FASTCALL|METH_KEYWORDS, _imp_find_frozen__doc__}, - -static PyObject * -_imp_find_frozen_impl(PyObject *module, PyObject *name, int withdata); - -static PyObject * -_imp_find_frozen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(withdata), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"", "withdata", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "find_frozen", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; - PyObject *name; - int withdata = 0; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("find_frozen", "argument 1", "str", args[0]); - goto exit; - } - if (PyUnicode_READY(args[0]) == -1) { - goto exit; - } - name = args[0]; - if (!noptargs) { - goto skip_optional_kwonly; - } - withdata = PyObject_IsTrue(args[1]); - if (withdata < 0) { - goto exit; - } -skip_optional_kwonly: - return_value = _imp_find_frozen_impl(module, name, withdata); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_get_frozen_object__doc__, -"get_frozen_object($module, name, data=None, /)\n" -"--\n" -"\n" -"Create a code object for a frozen module."); - -#define _IMP_GET_FROZEN_OBJECT_METHODDEF \ - {"get_frozen_object", _PyCFunction_CAST(_imp_get_frozen_object), METH_FASTCALL, _imp_get_frozen_object__doc__}, - -static PyObject * -_imp_get_frozen_object_impl(PyObject *module, PyObject *name, - PyObject *dataobj); - -static PyObject * -_imp_get_frozen_object(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *name; - PyObject *dataobj = Py_None; - - if (!_PyArg_CheckPositional("get_frozen_object", nargs, 1, 2)) { - goto exit; - } - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("get_frozen_object", "argument 1", "str", args[0]); - goto exit; - } - if (PyUnicode_READY(args[0]) == -1) { - goto exit; - } - name = args[0]; - if (nargs < 2) { - goto skip_optional; - } - dataobj = args[1]; -skip_optional: - return_value = _imp_get_frozen_object_impl(module, name, dataobj); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_frozen_package__doc__, -"is_frozen_package($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name is of a frozen package."); - -#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ - {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__}, - -static PyObject * -_imp_is_frozen_package_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_frozen_package(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("is_frozen_package", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; - return_value = _imp_is_frozen_package_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_builtin__doc__, -"is_builtin($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name corresponds to a built-in module."); - -#define _IMP_IS_BUILTIN_METHODDEF \ - {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__}, - -static PyObject * -_imp_is_builtin_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_builtin(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("is_builtin", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; - return_value = _imp_is_builtin_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_is_frozen__doc__, -"is_frozen($module, name, /)\n" -"--\n" -"\n" -"Returns True if the module name corresponds to a frozen module."); - -#define _IMP_IS_FROZEN_METHODDEF \ - {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__}, - -static PyObject * -_imp_is_frozen_impl(PyObject *module, PyObject *name); - -static PyObject * -_imp_is_frozen(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *name; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("is_frozen", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - name = arg; - return_value = _imp_is_frozen_impl(module, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp__frozen_module_names__doc__, -"_frozen_module_names($module, /)\n" -"--\n" -"\n" -"Returns the list of available frozen modules."); - -#define _IMP__FROZEN_MODULE_NAMES_METHODDEF \ - {"_frozen_module_names", (PyCFunction)_imp__frozen_module_names, METH_NOARGS, _imp__frozen_module_names__doc__}, - -static PyObject * -_imp__frozen_module_names_impl(PyObject *module); - -static PyObject * -_imp__frozen_module_names(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return _imp__frozen_module_names_impl(module); -} - -PyDoc_STRVAR(_imp__override_frozen_modules_for_tests__doc__, -"_override_frozen_modules_for_tests($module, override, /)\n" -"--\n" -"\n" -"(internal-only) Override PyConfig.use_frozen_modules.\n" -"\n" -"(-1: \"off\", 1: \"on\", 0: no override)\n" -"See frozen_modules() in Lib/test/support/import_helper.py."); - -#define _IMP__OVERRIDE_FROZEN_MODULES_FOR_TESTS_METHODDEF \ - {"_override_frozen_modules_for_tests", (PyCFunction)_imp__override_frozen_modules_for_tests, METH_O, _imp__override_frozen_modules_for_tests__doc__}, - -static PyObject * -_imp__override_frozen_modules_for_tests_impl(PyObject *module, int override); - -static PyObject * -_imp__override_frozen_modules_for_tests(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int override; - - override = _PyLong_AsInt(arg); - if (override == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = _imp__override_frozen_modules_for_tests_impl(module, override); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp__override_multi_interp_extensions_check__doc__, -"_override_multi_interp_extensions_check($module, override, /)\n" -"--\n" -"\n" -"(internal-only) Override PyInterpreterConfig.check_multi_interp_extensions.\n" -"\n" -"(-1: \"never\", 1: \"always\", 0: no override)"); - -#define _IMP__OVERRIDE_MULTI_INTERP_EXTENSIONS_CHECK_METHODDEF \ - {"_override_multi_interp_extensions_check", (PyCFunction)_imp__override_multi_interp_extensions_check, METH_O, _imp__override_multi_interp_extensions_check__doc__}, - -static PyObject * -_imp__override_multi_interp_extensions_check_impl(PyObject *module, - int override); - -static PyObject * -_imp__override_multi_interp_extensions_check(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int override; - - override = _PyLong_AsInt(arg); - if (override == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = _imp__override_multi_interp_extensions_check_impl(module, override); - -exit: - return return_value; -} - -#if defined(HAVE_DYNAMIC_LOADING) - -PyDoc_STRVAR(_imp_create_dynamic__doc__, -"create_dynamic($module, spec, file=<unrepresentable>, /)\n" -"--\n" -"\n" -"Create an extension module."); - -#define _IMP_CREATE_DYNAMIC_METHODDEF \ - {"create_dynamic", _PyCFunction_CAST(_imp_create_dynamic), METH_FASTCALL, _imp_create_dynamic__doc__}, - -static PyObject * -_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file); - -static PyObject * -_imp_create_dynamic(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *spec; - PyObject *file = NULL; - - if (!_PyArg_CheckPositional("create_dynamic", nargs, 1, 2)) { - goto exit; - } - spec = args[0]; - if (nargs < 2) { - goto skip_optional; - } - file = args[1]; -skip_optional: - return_value = _imp_create_dynamic_impl(module, spec, file); - -exit: - return return_value; -} - -#endif /* defined(HAVE_DYNAMIC_LOADING) */ - -#if defined(HAVE_DYNAMIC_LOADING) - -PyDoc_STRVAR(_imp_exec_dynamic__doc__, -"exec_dynamic($module, mod, /)\n" -"--\n" -"\n" -"Initialize an extension module."); - -#define _IMP_EXEC_DYNAMIC_METHODDEF \ - {"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__}, - -static int -_imp_exec_dynamic_impl(PyObject *module, PyObject *mod); - -static PyObject * -_imp_exec_dynamic(PyObject *module, PyObject *mod) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = _imp_exec_dynamic_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -#endif /* defined(HAVE_DYNAMIC_LOADING) */ - -PyDoc_STRVAR(_imp_exec_builtin__doc__, -"exec_builtin($module, mod, /)\n" -"--\n" -"\n" -"Initialize a built-in module."); - -#define _IMP_EXEC_BUILTIN_METHODDEF \ - {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__}, - -static int -_imp_exec_builtin_impl(PyObject *module, PyObject *mod); - -static PyObject * -_imp_exec_builtin(PyObject *module, PyObject *mod) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = _imp_exec_builtin_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(_imp_source_hash__doc__, -"source_hash($module, /, key, source)\n" -"--\n" -"\n"); - -#define _IMP_SOURCE_HASH_METHODDEF \ - {"source_hash", _PyCFunction_CAST(_imp_source_hash), METH_FASTCALL|METH_KEYWORDS, _imp_source_hash__doc__}, - -static PyObject * -_imp_source_hash_impl(PyObject *module, long key, Py_buffer *source); - -static PyObject * -_imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 2 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(key), &_Py_ID(source), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"key", "source", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "source_hash", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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; - } - 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: - /* Cleanup for source */ - if (source.obj) { - PyBuffer_Release(&source); - } - - return return_value; -} - -#ifndef _IMP_CREATE_DYNAMIC_METHODDEF - #define _IMP_CREATE_DYNAMIC_METHODDEF -#endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */ - -#ifndef _IMP_EXEC_DYNAMIC_METHODDEF - #define _IMP_EXEC_DYNAMIC_METHODDEF -#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=b18d46e0036eff49 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/instrumentation.c.h b/contrib/tools/python3/src/Python/clinic/instrumentation.c.h deleted file mode 100644 index cf3984ca24..0000000000 --- a/contrib/tools/python3/src/Python/clinic/instrumentation.c.h +++ /dev/null @@ -1,311 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(monitoring_use_tool_id__doc__, -"use_tool_id($module, tool_id, name, /)\n" -"--\n" -"\n"); - -#define MONITORING_USE_TOOL_ID_METHODDEF \ - {"use_tool_id", _PyCFunction_CAST(monitoring_use_tool_id), METH_FASTCALL, monitoring_use_tool_id__doc__}, - -static PyObject * -monitoring_use_tool_id_impl(PyObject *module, int tool_id, PyObject *name); - -static PyObject * -monitoring_use_tool_id(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int tool_id; - PyObject *name; - - if (!_PyArg_CheckPositional("use_tool_id", nargs, 2, 2)) { - goto exit; - } - tool_id = _PyLong_AsInt(args[0]); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - name = args[1]; - return_value = monitoring_use_tool_id_impl(module, tool_id, name); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_free_tool_id__doc__, -"free_tool_id($module, tool_id, /)\n" -"--\n" -"\n"); - -#define MONITORING_FREE_TOOL_ID_METHODDEF \ - {"free_tool_id", (PyCFunction)monitoring_free_tool_id, METH_O, monitoring_free_tool_id__doc__}, - -static PyObject * -monitoring_free_tool_id_impl(PyObject *module, int tool_id); - -static PyObject * -monitoring_free_tool_id(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int tool_id; - - tool_id = _PyLong_AsInt(arg); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = monitoring_free_tool_id_impl(module, tool_id); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_get_tool__doc__, -"get_tool($module, tool_id, /)\n" -"--\n" -"\n"); - -#define MONITORING_GET_TOOL_METHODDEF \ - {"get_tool", (PyCFunction)monitoring_get_tool, METH_O, monitoring_get_tool__doc__}, - -static PyObject * -monitoring_get_tool_impl(PyObject *module, int tool_id); - -static PyObject * -monitoring_get_tool(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int tool_id; - - tool_id = _PyLong_AsInt(arg); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = monitoring_get_tool_impl(module, tool_id); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_register_callback__doc__, -"register_callback($module, tool_id, event, func, /)\n" -"--\n" -"\n"); - -#define MONITORING_REGISTER_CALLBACK_METHODDEF \ - {"register_callback", _PyCFunction_CAST(monitoring_register_callback), METH_FASTCALL, monitoring_register_callback__doc__}, - -static PyObject * -monitoring_register_callback_impl(PyObject *module, int tool_id, int event, - PyObject *func); - -static PyObject * -monitoring_register_callback(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int tool_id; - int event; - PyObject *func; - - if (!_PyArg_CheckPositional("register_callback", nargs, 3, 3)) { - goto exit; - } - tool_id = _PyLong_AsInt(args[0]); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - event = _PyLong_AsInt(args[1]); - if (event == -1 && PyErr_Occurred()) { - goto exit; - } - func = args[2]; - return_value = monitoring_register_callback_impl(module, tool_id, event, func); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_get_events__doc__, -"get_events($module, tool_id, /)\n" -"--\n" -"\n"); - -#define MONITORING_GET_EVENTS_METHODDEF \ - {"get_events", (PyCFunction)monitoring_get_events, METH_O, monitoring_get_events__doc__}, - -static int -monitoring_get_events_impl(PyObject *module, int tool_id); - -static PyObject * -monitoring_get_events(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - int tool_id; - int _return_value; - - tool_id = _PyLong_AsInt(arg); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - _return_value = monitoring_get_events_impl(module, tool_id); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_set_events__doc__, -"set_events($module, tool_id, event_set, /)\n" -"--\n" -"\n"); - -#define MONITORING_SET_EVENTS_METHODDEF \ - {"set_events", _PyCFunction_CAST(monitoring_set_events), METH_FASTCALL, monitoring_set_events__doc__}, - -static PyObject * -monitoring_set_events_impl(PyObject *module, int tool_id, int event_set); - -static PyObject * -monitoring_set_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int tool_id; - int event_set; - - if (!_PyArg_CheckPositional("set_events", nargs, 2, 2)) { - goto exit; - } - tool_id = _PyLong_AsInt(args[0]); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - event_set = _PyLong_AsInt(args[1]); - if (event_set == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = monitoring_set_events_impl(module, tool_id, event_set); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_get_local_events__doc__, -"get_local_events($module, tool_id, code, /)\n" -"--\n" -"\n"); - -#define MONITORING_GET_LOCAL_EVENTS_METHODDEF \ - {"get_local_events", _PyCFunction_CAST(monitoring_get_local_events), METH_FASTCALL, monitoring_get_local_events__doc__}, - -static int -monitoring_get_local_events_impl(PyObject *module, int tool_id, - PyObject *code); - -static PyObject * -monitoring_get_local_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int tool_id; - PyObject *code; - int _return_value; - - if (!_PyArg_CheckPositional("get_local_events", nargs, 2, 2)) { - goto exit; - } - tool_id = _PyLong_AsInt(args[0]); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - code = args[1]; - _return_value = monitoring_get_local_events_impl(module, tool_id, code); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_set_local_events__doc__, -"set_local_events($module, tool_id, code, event_set, /)\n" -"--\n" -"\n"); - -#define MONITORING_SET_LOCAL_EVENTS_METHODDEF \ - {"set_local_events", _PyCFunction_CAST(monitoring_set_local_events), METH_FASTCALL, monitoring_set_local_events__doc__}, - -static PyObject * -monitoring_set_local_events_impl(PyObject *module, int tool_id, - PyObject *code, int event_set); - -static PyObject * -monitoring_set_local_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - int tool_id; - PyObject *code; - int event_set; - - if (!_PyArg_CheckPositional("set_local_events", nargs, 3, 3)) { - goto exit; - } - tool_id = _PyLong_AsInt(args[0]); - if (tool_id == -1 && PyErr_Occurred()) { - goto exit; - } - code = args[1]; - event_set = _PyLong_AsInt(args[2]); - if (event_set == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = monitoring_set_local_events_impl(module, tool_id, code, event_set); - -exit: - return return_value; -} - -PyDoc_STRVAR(monitoring_restart_events__doc__, -"restart_events($module, /)\n" -"--\n" -"\n"); - -#define MONITORING_RESTART_EVENTS_METHODDEF \ - {"restart_events", (PyCFunction)monitoring_restart_events, METH_NOARGS, monitoring_restart_events__doc__}, - -static PyObject * -monitoring_restart_events_impl(PyObject *module); - -static PyObject * -monitoring_restart_events(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return monitoring_restart_events_impl(module); -} - -PyDoc_STRVAR(monitoring__all_events__doc__, -"_all_events($module, /)\n" -"--\n" -"\n"); - -#define MONITORING__ALL_EVENTS_METHODDEF \ - {"_all_events", (PyCFunction)monitoring__all_events, METH_NOARGS, monitoring__all_events__doc__}, - -static PyObject * -monitoring__all_events_impl(PyObject *module); - -static PyObject * -monitoring__all_events(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return monitoring__all_events_impl(module); -} -/*[clinic end generated code: output=11cc0803875b3ffa input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/marshal.c.h b/contrib/tools/python3/src/Python/clinic/marshal.c.h deleted file mode 100644 index a593b98054..0000000000 --- a/contrib/tools/python3/src/Python/clinic/marshal.c.h +++ /dev/null @@ -1,164 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(marshal_dump__doc__, -"dump($module, value, file, version=version, /)\n" -"--\n" -"\n" -"Write the value on the open file.\n" -"\n" -" value\n" -" Must be a supported type.\n" -" file\n" -" Must be a writeable binary file.\n" -" version\n" -" Indicates the data format that dump should use.\n" -"\n" -"If the value has (or contains an object that has) an unsupported type, a\n" -"ValueError exception is raised - but garbage data will also be written\n" -"to the file. The object will not be properly read back by load()."); - -#define MARSHAL_DUMP_METHODDEF \ - {"dump", _PyCFunction_CAST(marshal_dump), METH_FASTCALL, marshal_dump__doc__}, - -static PyObject * -marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, - int version); - -static PyObject * -marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - PyObject *file; - int version = Py_MARSHAL_VERSION; - - if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { - goto exit; - } - value = args[0]; - file = args[1]; - if (nargs < 3) { - goto skip_optional; - } - version = _PyLong_AsInt(args[2]); - if (version == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: - return_value = marshal_dump_impl(module, value, file, version); - -exit: - return return_value; -} - -PyDoc_STRVAR(marshal_load__doc__, -"load($module, file, /)\n" -"--\n" -"\n" -"Read one value from the open file and return it.\n" -"\n" -" file\n" -" Must be readable binary file.\n" -"\n" -"If no valid value is read (e.g. because the data has a different Python\n" -"version\'s incompatible marshal format), raise EOFError, ValueError or\n" -"TypeError.\n" -"\n" -"Note: If an object containing an unsupported type was marshalled with\n" -"dump(), load() will substitute None for the unmarshallable type."); - -#define MARSHAL_LOAD_METHODDEF \ - {"load", (PyCFunction)marshal_load, METH_O, marshal_load__doc__}, - -PyDoc_STRVAR(marshal_dumps__doc__, -"dumps($module, value, version=version, /)\n" -"--\n" -"\n" -"Return the bytes object that would be written to a file by dump(value, file).\n" -"\n" -" value\n" -" Must be a supported type.\n" -" version\n" -" Indicates the data format that dumps should use.\n" -"\n" -"Raise a ValueError exception if value has (or contains an object that has) an\n" -"unsupported type."); - -#define MARSHAL_DUMPS_METHODDEF \ - {"dumps", _PyCFunction_CAST(marshal_dumps), METH_FASTCALL, marshal_dumps__doc__}, - -static PyObject * -marshal_dumps_impl(PyObject *module, PyObject *value, int version); - -static PyObject * -marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - PyObject *value; - int version = Py_MARSHAL_VERSION; - - if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { - goto exit; - } - value = args[0]; - if (nargs < 2) { - goto skip_optional; - } - version = _PyLong_AsInt(args[1]); - if (version == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: - return_value = marshal_dumps_impl(module, value, version); - -exit: - return return_value; -} - -PyDoc_STRVAR(marshal_loads__doc__, -"loads($module, bytes, /)\n" -"--\n" -"\n" -"Convert the bytes-like object to a value.\n" -"\n" -"If no valid value is found, raise EOFError, ValueError or TypeError. Extra\n" -"bytes in the input are ignored."); - -#define MARSHAL_LOADS_METHODDEF \ - {"loads", (PyCFunction)marshal_loads, METH_O, marshal_loads__doc__}, - -static PyObject * -marshal_loads_impl(PyObject *module, Py_buffer *bytes); - -static PyObject * -marshal_loads(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - Py_buffer bytes = {NULL, NULL}; - - 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: - /* Cleanup for bytes */ - if (bytes.obj) { - PyBuffer_Release(&bytes); - } - - return return_value; -} -/*[clinic end generated code: output=12082d61d2942473 input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/sysmodule.c.h b/contrib/tools/python3/src/Python/clinic/sysmodule.c.h deleted file mode 100644 index 7a7c188bcc..0000000000 --- a/contrib/tools/python3/src/Python/clinic/sysmodule.c.h +++ /dev/null @@ -1,1418 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(sys_addaudithook__doc__, -"addaudithook($module, /, hook)\n" -"--\n" -"\n" -"Adds a new audit hook callback."); - -#define SYS_ADDAUDITHOOK_METHODDEF \ - {"addaudithook", _PyCFunction_CAST(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; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(hook), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"hook", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "addaudithook", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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_CAST(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_exception__doc__, -"exception($module, /)\n" -"--\n" -"\n" -"Return the current exception.\n" -"\n" -"Return the most recent exception caught by an except clause\n" -"in the current stack frame or in an older stack frame, or None\n" -"if no such exception exists."); - -#define SYS_EXCEPTION_METHODDEF \ - {"exception", (PyCFunction)sys_exception, METH_NOARGS, sys_exception__doc__}, - -static PyObject * -sys_exception_impl(PyObject *module); - -static PyObject * -sys_exception(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_exception_impl(module); -} - -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_CAST(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__settraceallthreads__doc__, -"_settraceallthreads($module, arg, /)\n" -"--\n" -"\n" -"Set the global debug tracing function in all running threads belonging to the current interpreter.\n" -"\n" -"It will be called on each function call. See the debugger chapter\n" -"in the library manual."); - -#define SYS__SETTRACEALLTHREADS_METHODDEF \ - {"_settraceallthreads", (PyCFunction)sys__settraceallthreads, METH_O, sys__settraceallthreads__doc__}, - -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__setprofileallthreads__doc__, -"_setprofileallthreads($module, arg, /)\n" -"--\n" -"\n" -"Set the profiling function in all running threads belonging to the current interpreter.\n" -"\n" -"It will be called on each function call and return. See the profiler chapter\n" -"in the library manual."); - -#define SYS__SETPROFILEALLTHREADS_METHODDEF \ - {"_setprofileallthreads", (PyCFunction)sys__setprofileallthreads, METH_O, sys__setprofileallthreads__doc__}, - -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; - - 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."); - -#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ - {"set_coroutine_origin_tracking_depth", _PyCFunction_CAST(sys_set_coroutine_origin_tracking_depth), METH_FASTCALL|METH_KEYWORDS, sys_set_coroutine_origin_tracking_depth__doc__}, - -static PyObject * -sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth); - -static PyObject * -sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(depth), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"depth", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "set_coroutine_origin_tracking_depth", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[1]; - int depth; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - 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: - return return_value; -} - -PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__, -"get_coroutine_origin_tracking_depth($module, /)\n" -"--\n" -"\n" -"Check status of origin tracking for coroutine objects in this thread."); - -#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \ - {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__}, - -static int -sys_get_coroutine_origin_tracking_depth_impl(PyObject *module); - -static PyObject * -sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - int _return_value; - - _return_value = sys_get_coroutine_origin_tracking_depth_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) { - goto exit; - } - return_value = PyLong_FromLong((long)_return_value); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_get_asyncgen_hooks__doc__, -"get_asyncgen_hooks($module, /)\n" -"--\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; - - 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; - - 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_get_int_max_str_digits__doc__, -"get_int_max_str_digits($module, /)\n" -"--\n" -"\n" -"Return the maximum string digits limit for non-binary int<->str conversions."); - -#define SYS_GET_INT_MAX_STR_DIGITS_METHODDEF \ - {"get_int_max_str_digits", (PyCFunction)sys_get_int_max_str_digits, METH_NOARGS, sys_get_int_max_str_digits__doc__}, - -static PyObject * -sys_get_int_max_str_digits_impl(PyObject *module); - -static PyObject * -sys_get_int_max_str_digits(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_get_int_max_str_digits_impl(module); -} - -PyDoc_STRVAR(sys_set_int_max_str_digits__doc__, -"set_int_max_str_digits($module, /, maxdigits)\n" -"--\n" -"\n" -"Set the maximum string digits limit for non-binary int<->str conversions."); - -#define SYS_SET_INT_MAX_STR_DIGITS_METHODDEF \ - {"set_int_max_str_digits", _PyCFunction_CAST(sys_set_int_max_str_digits), METH_FASTCALL|METH_KEYWORDS, sys_set_int_max_str_digits__doc__}, - -static PyObject * -sys_set_int_max_str_digits_impl(PyObject *module, int maxdigits); - -static PyObject * -sys_set_int_max_str_digits(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(maxdigits), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"maxdigits", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "set_int_max_str_digits", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[1]; - int maxdigits; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - maxdigits = _PyLong_AsInt(args[0]); - if (maxdigits == -1 && PyErr_Occurred()) { - goto exit; - } - return_value = sys_set_int_max_str_digits_impl(module, maxdigits); - -exit: - return return_value; -} - -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_getunicodeinternedsize__doc__, -"getunicodeinternedsize($module, /)\n" -"--\n" -"\n" -"Return the number of elements of the unicode interned dictionary"); - -#define SYS_GETUNICODEINTERNEDSIZE_METHODDEF \ - {"getunicodeinternedsize", (PyCFunction)sys_getunicodeinternedsize, METH_NOARGS, sys_getunicodeinternedsize__doc__}, - -static Py_ssize_t -sys_getunicodeinternedsize_impl(PyObject *module); - -static PyObject * -sys_getunicodeinternedsize(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - PyObject *return_value = NULL; - Py_ssize_t _return_value; - - _return_value = sys_getunicodeinternedsize_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_CAST(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; - } - 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__current_exceptions__doc__, -"_current_exceptions($module, /)\n" -"--\n" -"\n" -"Return a dict mapping each thread\'s identifier to its current raised exception.\n" -"\n" -"This function should be used for specialized purposes only."); - -#define SYS__CURRENT_EXCEPTIONS_METHODDEF \ - {"_current_exceptions", (PyCFunction)sys__current_exceptions, METH_NOARGS, sys__current_exceptions__doc__}, - -static PyObject * -sys__current_exceptions_impl(PyObject *module); - -static PyObject * -sys__current_exceptions(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__current_exceptions_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_CAST(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(Py_STATS) - -PyDoc_STRVAR(sys__stats_on__doc__, -"_stats_on($module, /)\n" -"--\n" -"\n" -"Turns on stats gathering (stats gathering is on by default)."); - -#define SYS__STATS_ON_METHODDEF \ - {"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__}, - -static PyObject * -sys__stats_on_impl(PyObject *module); - -static PyObject * -sys__stats_on(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__stats_on_impl(module); -} - -#endif /* defined(Py_STATS) */ - -#if defined(Py_STATS) - -PyDoc_STRVAR(sys__stats_off__doc__, -"_stats_off($module, /)\n" -"--\n" -"\n" -"Turns off stats gathering (stats gathering is on by default)."); - -#define SYS__STATS_OFF_METHODDEF \ - {"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__}, - -static PyObject * -sys__stats_off_impl(PyObject *module); - -static PyObject * -sys__stats_off(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__stats_off_impl(module); -} - -#endif /* defined(Py_STATS) */ - -#if defined(Py_STATS) - -PyDoc_STRVAR(sys__stats_clear__doc__, -"_stats_clear($module, /)\n" -"--\n" -"\n" -"Clears the stats."); - -#define SYS__STATS_CLEAR_METHODDEF \ - {"_stats_clear", (PyCFunction)sys__stats_clear, METH_NOARGS, sys__stats_clear__doc__}, - -static PyObject * -sys__stats_clear_impl(PyObject *module); - -static PyObject * -sys__stats_clear(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__stats_clear_impl(module); -} - -#endif /* defined(Py_STATS) */ - -#if defined(Py_STATS) - -PyDoc_STRVAR(sys__stats_dump__doc__, -"_stats_dump($module, /)\n" -"--\n" -"\n" -"Dump stats to file, and clears the stats."); - -#define SYS__STATS_DUMP_METHODDEF \ - {"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__}, - -static PyObject * -sys__stats_dump_impl(PyObject *module); - -static PyObject * -sys__stats_dump(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys__stats_dump_impl(module); -} - -#endif /* defined(Py_STATS) */ - -#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) */ - -PyDoc_STRVAR(sys_activate_stack_trampoline__doc__, -"activate_stack_trampoline($module, backend, /)\n" -"--\n" -"\n" -"Activate stack profiler trampoline *backend*."); - -#define SYS_ACTIVATE_STACK_TRAMPOLINE_METHODDEF \ - {"activate_stack_trampoline", (PyCFunction)sys_activate_stack_trampoline, METH_O, sys_activate_stack_trampoline__doc__}, - -static PyObject * -sys_activate_stack_trampoline_impl(PyObject *module, const char *backend); - -static PyObject * -sys_activate_stack_trampoline(PyObject *module, PyObject *arg) -{ - PyObject *return_value = NULL; - const char *backend; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("activate_stack_trampoline", "argument", "str", arg); - goto exit; - } - Py_ssize_t backend_length; - backend = PyUnicode_AsUTF8AndSize(arg, &backend_length); - if (backend == NULL) { - goto exit; - } - if (strlen(backend) != (size_t)backend_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - return_value = sys_activate_stack_trampoline_impl(module, backend); - -exit: - return return_value; -} - -PyDoc_STRVAR(sys_deactivate_stack_trampoline__doc__, -"deactivate_stack_trampoline($module, /)\n" -"--\n" -"\n" -"Deactivate the current stack profiler trampoline backend.\n" -"\n" -"If no stack profiler is activated, this function has no effect."); - -#define SYS_DEACTIVATE_STACK_TRAMPOLINE_METHODDEF \ - {"deactivate_stack_trampoline", (PyCFunction)sys_deactivate_stack_trampoline, METH_NOARGS, sys_deactivate_stack_trampoline__doc__}, - -static PyObject * -sys_deactivate_stack_trampoline_impl(PyObject *module); - -static PyObject * -sys_deactivate_stack_trampoline(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_deactivate_stack_trampoline_impl(module); -} - -PyDoc_STRVAR(sys_is_stack_trampoline_active__doc__, -"is_stack_trampoline_active($module, /)\n" -"--\n" -"\n" -"Return *True* if a stack profiler trampoline is active."); - -#define SYS_IS_STACK_TRAMPOLINE_ACTIVE_METHODDEF \ - {"is_stack_trampoline_active", (PyCFunction)sys_is_stack_trampoline_active, METH_NOARGS, sys_is_stack_trampoline_active__doc__}, - -static PyObject * -sys_is_stack_trampoline_active_impl(PyObject *module); - -static PyObject * -sys_is_stack_trampoline_active(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - return sys_is_stack_trampoline_active_impl(module); -} - -PyDoc_STRVAR(sys__getframemodulename__doc__, -"_getframemodulename($module, /, depth=0)\n" -"--\n" -"\n" -"Return the name of the module for a calling frame.\n" -"\n" -"The default depth returns the module containing the call to this API.\n" -"A more typical use in a library will pass a depth of 1 to get the user\'s\n" -"module rather than the library module.\n" -"\n" -"If no frame, module, or name can be found, returns None."); - -#define SYS__GETFRAMEMODULENAME_METHODDEF \ - {"_getframemodulename", _PyCFunction_CAST(sys__getframemodulename), METH_FASTCALL|METH_KEYWORDS, sys__getframemodulename__doc__}, - -static PyObject * -sys__getframemodulename_impl(PyObject *module, int depth); - -static PyObject * -sys__getframemodulename(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 1 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(depth), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"depth", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "_getframemodulename", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - PyObject *argsbuf[1]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; - int depth = 0; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); - if (!args) { - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - depth = _PyLong_AsInt(args[0]); - if (depth == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: - return_value = sys__getframemodulename_impl(module, depth); - -exit: - return return_value; -} - -#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__STATS_ON_METHODDEF - #define SYS__STATS_ON_METHODDEF -#endif /* !defined(SYS__STATS_ON_METHODDEF) */ - -#ifndef SYS__STATS_OFF_METHODDEF - #define SYS__STATS_OFF_METHODDEF -#endif /* !defined(SYS__STATS_OFF_METHODDEF) */ - -#ifndef SYS__STATS_CLEAR_METHODDEF - #define SYS__STATS_CLEAR_METHODDEF -#endif /* !defined(SYS__STATS_CLEAR_METHODDEF) */ - -#ifndef SYS__STATS_DUMP_METHODDEF - #define SYS__STATS_DUMP_METHODDEF -#endif /* !defined(SYS__STATS_DUMP_METHODDEF) */ - -#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF - #define SYS_GETANDROIDAPILEVEL_METHODDEF -#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=6d598acc26237fbe input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Python/clinic/traceback.c.h b/contrib/tools/python3/src/Python/clinic/traceback.c.h deleted file mode 100644 index 3c34493497..0000000000 --- a/contrib/tools/python3/src/Python/clinic/traceback.c.h +++ /dev/null @@ -1,81 +0,0 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - -PyDoc_STRVAR(tb_new__doc__, -"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n" -"--\n" -"\n" -"Create a new traceback object."); - -static PyObject * -tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame, - int tb_lasti, int tb_lineno); - -static PyObject * -tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - PyObject *return_value = NULL; - #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) - - #define NUM_KEYWORDS 4 - static struct { - PyGC_Head _this_is_not_used; - PyObject_VAR_HEAD - PyObject *ob_item[NUM_KEYWORDS]; - } _kwtuple = { - .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) - .ob_item = { &_Py_ID(tb_next), &_Py_ID(tb_frame), &_Py_ID(tb_lasti), &_Py_ID(tb_lineno), }, - }; - #undef NUM_KEYWORDS - #define KWTUPLE (&_kwtuple.ob_base.ob_base) - - #else // !Py_BUILD_CORE - # define KWTUPLE NULL - #endif // !Py_BUILD_CORE - - static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL}; - static _PyArg_Parser _parser = { - .keywords = _keywords, - .fname = "TracebackType", - .kwtuple = KWTUPLE, - }; - #undef KWTUPLE - 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]; - tb_lasti = _PyLong_AsInt(fastargs[2]); - if (tb_lasti == -1 && PyErr_Occurred()) { - 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=7bc9927e362fdfb7 input=a9049054013a1b77]*/ |