summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/clinic
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Python/clinic')
-rw-r--r--contrib/tools/python3/Python/clinic/Python-tokenize.c.h8
-rw-r--r--contrib/tools/python3/Python/clinic/_warnings.c.h14
-rw-r--r--contrib/tools/python3/Python/clinic/bltinmodule.c.h332
-rw-r--r--contrib/tools/python3/Python/clinic/context.c.h8
-rw-r--r--contrib/tools/python3/Python/clinic/import.c.h37
-rw-r--r--contrib/tools/python3/Python/clinic/instruction_sequence.c.h304
-rw-r--r--contrib/tools/python3/Python/clinic/instrumentation.c.h30
-rw-r--r--contrib/tools/python3/Python/clinic/marshal.c.h242
-rw-r--r--contrib/tools/python3/Python/clinic/sysmodule.c.h205
-rw-r--r--contrib/tools/python3/Python/clinic/traceback.c.h18
10 files changed, 816 insertions, 382 deletions
diff --git a/contrib/tools/python3/Python/clinic/Python-tokenize.c.h b/contrib/tools/python3/Python/clinic/Python-tokenize.c.h
index 28f5075826e..730fa8ef2a2 100644
--- a/contrib/tools/python3/Python/clinic/Python-tokenize.c.h
+++ b/contrib/tools/python3/Python/clinic/Python-tokenize.c.h
@@ -3,10 +3,10 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
static PyObject *
tokenizeriter_new_impl(PyTypeObject *type, PyObject *readline,
@@ -80,4 +80,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=48be65a2808bdfa6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dcd6ec48f06a092e input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/_warnings.c.h b/contrib/tools/python3/Python/clinic/_warnings.c.h
index 432e554af85..98dc49db305 100644
--- a/contrib/tools/python3/Python/clinic/_warnings.c.h
+++ b/contrib/tools/python3/Python/clinic/_warnings.c.h
@@ -3,10 +3,11 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_abstract.h" // _PyNumber_Index()
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(warnings_warn__doc__,
"warn($module, /, message, category=None, stacklevel=1, source=None, *,\n"
@@ -193,11 +194,8 @@ warnings_warn_explicit(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_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]);
+ lineno = PyLong_AsInt(args[3]);
if (lineno == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -246,4 +244,4 @@ warnings_filters_mutated(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return warnings_filters_mutated_impl(module);
}
-/*[clinic end generated code: output=20429719d7223bdc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f2d4214c382717a6 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/bltinmodule.c.h b/contrib/tools/python3/Python/clinic/bltinmodule.c.h
index b77b4a1e4b4..370cf3c929b 100644
--- a/contrib/tools/python3/Python/clinic/bltinmodule.c.h
+++ b/contrib/tools/python3/Python/clinic/bltinmodule.c.h
@@ -3,10 +3,10 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(builtin___import____doc__,
"__import__($module, /, name, globals=None, locals=None, fromlist=(),\n"
@@ -99,7 +99,7 @@ builtin___import__(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto skip_optional_pos;
}
}
- level = _PyLong_AsInt(args[4]);
+ level = PyLong_AsInt(args[4]);
if (level == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -216,9 +216,6 @@ builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_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);
@@ -236,25 +233,6 @@ PyDoc_STRVAR(builtin_chr__doc__,
#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"
@@ -313,7 +291,7 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
PyObject *argsbuf[7];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
PyObject *source;
- PyObject *filename;
+ PyObject *filename = NULL;
const char *mode;
int flags = 0;
int dont_inherit = 0;
@@ -345,7 +323,7 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos;
}
if (args[3]) {
- flags = _PyLong_AsInt(args[3]);
+ flags = PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -363,7 +341,7 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[5]) {
- optimize = _PyLong_AsInt(args[5]);
+ optimize = PyLong_AsInt(args[5]);
if (optimize == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -375,7 +353,7 @@ skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
- feature_version = _PyLong_AsInt(args[6]);
+ feature_version = PyLong_AsInt(args[6]);
if (feature_version == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -383,49 +361,9 @@ skip_optional_kwonly:
return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version);
exit:
- return return_value;
-}
+ /* Cleanup for filename */
+ Py_XDECREF(filename);
-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;
}
@@ -460,7 +398,7 @@ exit:
}
PyDoc_STRVAR(builtin_eval__doc__,
-"eval($module, source, globals=None, locals=None, /)\n"
+"eval($module, source, /, globals=None, locals=None)\n"
"--\n"
"\n"
"Evaluate the given source in the context of globals and locals.\n"
@@ -472,33 +410,63 @@ PyDoc_STRVAR(builtin_eval__doc__,
"If only globals is given, locals defaults to it.");
#define BUILTIN_EVAL_METHODDEF \
- {"eval", _PyCFunction_CAST(builtin_eval), METH_FASTCALL, builtin_eval__doc__},
+ {"eval", _PyCFunction_CAST(builtin_eval), METH_FASTCALL|METH_KEYWORDS, 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)
+builtin_eval(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(globals), &_Py_ID(locals), },
+ };
+ #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[] = {"", "globals", "locals", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "eval",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *source;
PyObject *globals = Py_None;
PyObject *locals = Py_None;
- if (!_PyArg_CheckPositional("eval", nargs, 1, 3)) {
+ 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;
+ if (!noptargs) {
+ goto skip_optional_pos;
}
- globals = args[1];
- if (nargs < 3) {
- goto skip_optional;
+ if (args[1]) {
+ globals = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
}
locals = args[2];
-skip_optional:
+skip_optional_pos:
return_value = builtin_eval_impl(module, source, globals, locals);
exit:
@@ -506,7 +474,7 @@ exit:
}
PyDoc_STRVAR(builtin_exec__doc__,
-"exec($module, source, globals=None, locals=None, /, *, closure=None)\n"
+"exec($module, source, /, globals=None, locals=None, *, closure=None)\n"
"--\n"
"\n"
"Execute the given source in the context of globals and locals.\n"
@@ -532,14 +500,14 @@ builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
- #define NUM_KEYWORDS 1
+ #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(closure), },
+ .ob_item = { &_Py_ID(globals), &_Py_ID(locals), &_Py_ID(closure), },
};
#undef NUM_KEYWORDS
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
@@ -548,7 +516,7 @@ builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
# define KWTUPLE NULL
#endif // !Py_BUILD_CORE
- static const char * const _keywords[] = {"", "", "", "closure", NULL};
+ static const char * const _keywords[] = {"", "globals", "locals", "closure", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "exec",
@@ -567,17 +535,22 @@ builtin_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit;
}
source = args[0];
- if (nargs < 2) {
- goto skip_optional_posonly;
+ if (!noptargs) {
+ goto skip_optional_pos;
}
- noptargs--;
- globals = args[1];
- if (nargs < 3) {
- goto skip_optional_posonly;
+ if (args[1]) {
+ globals = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
}
- noptargs--;
- locals = args[2];
-skip_optional_posonly:
+ if (args[2]) {
+ locals = args[2];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
@@ -589,47 +562,6 @@ 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"
@@ -695,44 +627,6 @@ PyDoc_STRVAR(builtin_id__doc__,
#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"
@@ -824,43 +718,6 @@ PyDoc_STRVAR(builtin_hex__doc__,
#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"
@@ -874,10 +731,10 @@ PyDoc_STRVAR(builtin_anext__doc__,
"anext($module, aiterator, default=<unrepresentable>, /)\n"
"--\n"
"\n"
-"async anext(aiterator[, default])\n"
+"Return the next item from the async iterator.\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.");
+"If default is given and the async iterator is exhausted,\n"
+"it is returned instead of raising StopAsyncIteration.");
#define BUILTIN_ANEXT_METHODDEF \
{"anext", _PyCFunction_CAST(builtin_anext), METH_FASTCALL, builtin_anext__doc__},
@@ -952,10 +809,16 @@ PyDoc_STRVAR(builtin_oct__doc__,
{"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
PyDoc_STRVAR(builtin_ord__doc__,
-"ord($module, c, /)\n"
+"ord($module, character, /)\n"
"--\n"
"\n"
-"Return the Unicode code point for a one-character string.");
+"Return the ordinal value of a character.\n"
+"\n"
+"If the argument is a one-character string, return the Unicode code\n"
+"point of that character.\n"
+"\n"
+"If the argument is a bytes or bytearray object of length 1, return its\n"
+"single byte value.");
#define BUILTIN_ORD_METHODDEF \
{"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
@@ -1239,41 +1102,6 @@ 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"
@@ -1409,4 +1237,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=84a04e7446debf58 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=39173c70790d9cd0 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/context.c.h b/contrib/tools/python3/Python/clinic/context.c.h
index 27c375717bf..997ac6f6338 100644
--- a/contrib/tools/python3/Python/clinic/context.c.h
+++ b/contrib/tools/python3/Python/clinic/context.c.h
@@ -2,11 +2,7 @@
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
-
+#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(_contextvars_Context_get__doc__,
"get($self, key, default=None, /)\n"
@@ -183,4 +179,4 @@ PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__,
#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \
{"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__},
-/*[clinic end generated code: output=0c94d4b919500438 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b667826178444c3f input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/import.c.h b/contrib/tools/python3/Python/clinic/import.c.h
index cb74be6a422..5edeaef656e 100644
--- a/contrib/tools/python3/Python/clinic/import.c.h
+++ b/contrib/tools/python3/Python/clinic/import.c.h
@@ -3,10 +3,10 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(_imp_lock_held__doc__,
"lock_held($module, /)\n"
@@ -106,9 +106,6 @@ _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_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);
@@ -165,9 +162,6 @@ _imp_init_frozen(PyObject *module, PyObject *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);
@@ -237,9 +231,6 @@ _imp_find_frozen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
_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;
@@ -282,9 +273,6 @@ _imp_get_frozen_object(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_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;
@@ -319,9 +307,6 @@ _imp_is_frozen_package(PyObject *module, PyObject *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);
@@ -351,9 +336,6 @@ _imp_is_builtin(PyObject *module, PyObject *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);
@@ -383,9 +365,6 @@ _imp_is_frozen(PyObject *module, PyObject *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);
@@ -432,7 +411,7 @@ _imp__override_frozen_modules_for_tests(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int override;
- override = _PyLong_AsInt(arg);
+ override = PyLong_AsInt(arg);
if (override == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -463,7 +442,7 @@ _imp__override_multi_interp_extensions_check(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int override;
- override = _PyLong_AsInt(arg);
+ override = PyLong_AsInt(arg);
if (override == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -626,10 +605,6 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
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:
@@ -648,4 +623,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=b18d46e0036eff49 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dbd63707bd40b07c input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/instruction_sequence.c.h b/contrib/tools/python3/Python/clinic/instruction_sequence.c.h
new file mode 100644
index 00000000000..66c2ccadfa0
--- /dev/null
+++ b/contrib/tools/python3/Python/clinic/instruction_sequence.c.h
@@ -0,0 +1,304 @@
+/*[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
+#include "pycore_modsupport.h" // _PyArg_NoKeywords()
+
+PyDoc_STRVAR(inst_seq_new__doc__,
+"InstructionSequenceType()\n"
+"--\n"
+"\n"
+"Create a new InstructionSequence object.");
+
+static PyObject *
+inst_seq_new_impl(PyTypeObject *type);
+
+static PyObject *
+inst_seq_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ PyTypeObject *base_tp = &_PyInstructionSequence_Type;
+
+ if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
+ !_PyArg_NoPositional("InstructionSequenceType", args)) {
+ goto exit;
+ }
+ if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
+ !_PyArg_NoKeywords("InstructionSequenceType", kwargs)) {
+ goto exit;
+ }
+ return_value = inst_seq_new_impl(type);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(InstructionSequenceType_use_label__doc__,
+"use_label($self, /, label)\n"
+"--\n"
+"\n"
+"Place label at current location.");
+
+#define INSTRUCTIONSEQUENCETYPE_USE_LABEL_METHODDEF \
+ {"use_label", _PyCFunction_CAST(InstructionSequenceType_use_label), METH_FASTCALL|METH_KEYWORDS, InstructionSequenceType_use_label__doc__},
+
+static PyObject *
+InstructionSequenceType_use_label_impl(_PyInstructionSequence *self,
+ int label);
+
+static PyObject *
+InstructionSequenceType_use_label(_PyInstructionSequence *self, 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(label), },
+ };
+ #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[] = {"label", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "use_label",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[1];
+ int label;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ label = PyLong_AsInt(args[0]);
+ if (label == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = InstructionSequenceType_use_label_impl(self, label);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(InstructionSequenceType_addop__doc__,
+"addop($self, /, opcode, oparg, lineno, col_offset, end_lineno,\n"
+" end_col_offset)\n"
+"--\n"
+"\n"
+"Append an instruction.");
+
+#define INSTRUCTIONSEQUENCETYPE_ADDOP_METHODDEF \
+ {"addop", _PyCFunction_CAST(InstructionSequenceType_addop), METH_FASTCALL|METH_KEYWORDS, InstructionSequenceType_addop__doc__},
+
+static PyObject *
+InstructionSequenceType_addop_impl(_PyInstructionSequence *self, int opcode,
+ int oparg, int lineno, int col_offset,
+ int end_lineno, int end_col_offset);
+
+static PyObject *
+InstructionSequenceType_addop(_PyInstructionSequence *self, 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 6
+ 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(opcode), &_Py_ID(oparg), &_Py_ID(lineno), &_Py_ID(col_offset), &_Py_ID(end_lineno), &_Py_ID(end_col_offset), },
+ };
+ #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[] = {"opcode", "oparg", "lineno", "col_offset", "end_lineno", "end_col_offset", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "addop",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[6];
+ int opcode;
+ int oparg;
+ int lineno;
+ int col_offset;
+ int end_lineno;
+ int end_col_offset;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ opcode = PyLong_AsInt(args[0]);
+ if (opcode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ oparg = PyLong_AsInt(args[1]);
+ if (oparg == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ lineno = PyLong_AsInt(args[2]);
+ if (lineno == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ col_offset = PyLong_AsInt(args[3]);
+ if (col_offset == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ end_lineno = PyLong_AsInt(args[4]);
+ if (end_lineno == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ end_col_offset = PyLong_AsInt(args[5]);
+ if (end_col_offset == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = InstructionSequenceType_addop_impl(self, opcode, oparg, lineno, col_offset, end_lineno, end_col_offset);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(InstructionSequenceType_new_label__doc__,
+"new_label($self, /)\n"
+"--\n"
+"\n"
+"Return a new label.");
+
+#define INSTRUCTIONSEQUENCETYPE_NEW_LABEL_METHODDEF \
+ {"new_label", (PyCFunction)InstructionSequenceType_new_label, METH_NOARGS, InstructionSequenceType_new_label__doc__},
+
+static int
+InstructionSequenceType_new_label_impl(_PyInstructionSequence *self);
+
+static PyObject *
+InstructionSequenceType_new_label(_PyInstructionSequence *self, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = InstructionSequenceType_new_label_impl(self);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(InstructionSequenceType_add_nested__doc__,
+"add_nested($self, /, nested)\n"
+"--\n"
+"\n"
+"Add a nested sequence.");
+
+#define INSTRUCTIONSEQUENCETYPE_ADD_NESTED_METHODDEF \
+ {"add_nested", _PyCFunction_CAST(InstructionSequenceType_add_nested), METH_FASTCALL|METH_KEYWORDS, InstructionSequenceType_add_nested__doc__},
+
+static PyObject *
+InstructionSequenceType_add_nested_impl(_PyInstructionSequence *self,
+ PyObject *nested);
+
+static PyObject *
+InstructionSequenceType_add_nested(_PyInstructionSequence *self, 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(nested), },
+ };
+ #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[] = {"nested", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "add_nested",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[1];
+ PyObject *nested;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ nested = args[0];
+ return_value = InstructionSequenceType_add_nested_impl(self, nested);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(InstructionSequenceType_get_nested__doc__,
+"get_nested($self, /)\n"
+"--\n"
+"\n"
+"Add a nested sequence.");
+
+#define INSTRUCTIONSEQUENCETYPE_GET_NESTED_METHODDEF \
+ {"get_nested", (PyCFunction)InstructionSequenceType_get_nested, METH_NOARGS, InstructionSequenceType_get_nested__doc__},
+
+static PyObject *
+InstructionSequenceType_get_nested_impl(_PyInstructionSequence *self);
+
+static PyObject *
+InstructionSequenceType_get_nested(_PyInstructionSequence *self, PyObject *Py_UNUSED(ignored))
+{
+ return InstructionSequenceType_get_nested_impl(self);
+}
+
+PyDoc_STRVAR(InstructionSequenceType_get_instructions__doc__,
+"get_instructions($self, /)\n"
+"--\n"
+"\n"
+"Return the instructions as a list of tuples or labels.");
+
+#define INSTRUCTIONSEQUENCETYPE_GET_INSTRUCTIONS_METHODDEF \
+ {"get_instructions", (PyCFunction)InstructionSequenceType_get_instructions, METH_NOARGS, InstructionSequenceType_get_instructions__doc__},
+
+static PyObject *
+InstructionSequenceType_get_instructions_impl(_PyInstructionSequence *self);
+
+static PyObject *
+InstructionSequenceType_get_instructions(_PyInstructionSequence *self, PyObject *Py_UNUSED(ignored))
+{
+ return InstructionSequenceType_get_instructions_impl(self);
+}
+/*[clinic end generated code: output=8809d7aa11d9b2bb input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/instrumentation.c.h b/contrib/tools/python3/Python/clinic/instrumentation.c.h
index cf3984ca24b..8dae747c44a 100644
--- a/contrib/tools/python3/Python/clinic/instrumentation.c.h
+++ b/contrib/tools/python3/Python/clinic/instrumentation.c.h
@@ -2,11 +2,7 @@
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
-
+#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(monitoring_use_tool_id__doc__,
"use_tool_id($module, tool_id, name, /)\n"
@@ -29,7 +25,7 @@ monitoring_use_tool_id(PyObject *module, PyObject *const *args, Py_ssize_t nargs
if (!_PyArg_CheckPositional("use_tool_id", nargs, 2, 2)) {
goto exit;
}
- tool_id = _PyLong_AsInt(args[0]);
+ tool_id = PyLong_AsInt(args[0]);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -57,7 +53,7 @@ monitoring_free_tool_id(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int tool_id;
- tool_id = _PyLong_AsInt(arg);
+ tool_id = PyLong_AsInt(arg);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -84,7 +80,7 @@ monitoring_get_tool(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int tool_id;
- tool_id = _PyLong_AsInt(arg);
+ tool_id = PyLong_AsInt(arg);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -117,11 +113,11 @@ monitoring_register_callback(PyObject *module, PyObject *const *args, Py_ssize_t
if (!_PyArg_CheckPositional("register_callback", nargs, 3, 3)) {
goto exit;
}
- tool_id = _PyLong_AsInt(args[0]);
+ tool_id = PyLong_AsInt(args[0]);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
- event = _PyLong_AsInt(args[1]);
+ event = PyLong_AsInt(args[1]);
if (event == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -150,7 +146,7 @@ monitoring_get_events(PyObject *module, PyObject *arg)
int tool_id;
int _return_value;
- tool_id = _PyLong_AsInt(arg);
+ tool_id = PyLong_AsInt(arg);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -185,11 +181,11 @@ monitoring_set_events(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("set_events", nargs, 2, 2)) {
goto exit;
}
- tool_id = _PyLong_AsInt(args[0]);
+ tool_id = PyLong_AsInt(args[0]);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
- event_set = _PyLong_AsInt(args[1]);
+ event_set = PyLong_AsInt(args[1]);
if (event_set == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -222,7 +218,7 @@ monitoring_get_local_events(PyObject *module, PyObject *const *args, Py_ssize_t
if (!_PyArg_CheckPositional("get_local_events", nargs, 2, 2)) {
goto exit;
}
- tool_id = _PyLong_AsInt(args[0]);
+ tool_id = PyLong_AsInt(args[0]);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -260,12 +256,12 @@ monitoring_set_local_events(PyObject *module, PyObject *const *args, Py_ssize_t
if (!_PyArg_CheckPositional("set_local_events", nargs, 3, 3)) {
goto exit;
}
- tool_id = _PyLong_AsInt(args[0]);
+ tool_id = PyLong_AsInt(args[0]);
if (tool_id == -1 && PyErr_Occurred()) {
goto exit;
}
code = args[1];
- event_set = _PyLong_AsInt(args[2]);
+ event_set = PyLong_AsInt(args[2]);
if (event_set == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -308,4 +304,4 @@ monitoring__all_events(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return monitoring__all_events_impl(module);
}
-/*[clinic end generated code: output=11cc0803875b3ffa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=14ffc0884a6de50a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/marshal.c.h b/contrib/tools/python3/Python/clinic/marshal.c.h
index a593b980544..c19a3ed5050 100644
--- a/contrib/tools/python3/Python/clinic/marshal.c.h
+++ b/contrib/tools/python3/Python/clinic/marshal.c.h
@@ -3,13 +3,13 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(marshal_dump__doc__,
-"dump($module, value, file, version=version, /)\n"
+"dump($module, value, file, version=version, /, *, allow_code=True)\n"
"--\n"
"\n"
"Write the value on the open file.\n"
@@ -20,53 +20,95 @@ PyDoc_STRVAR(marshal_dump__doc__,
" Must be a writeable binary file.\n"
" version\n"
" Indicates the data format that dump should use.\n"
+" allow_code\n"
+" Allow to write code objects.\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__},
+ {"dump", _PyCFunction_CAST(marshal_dump), METH_FASTCALL|METH_KEYWORDS, marshal_dump__doc__},
static PyObject *
marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file,
- int version);
+ int version, int allow_code);
static PyObject *
-marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+marshal_dump(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(allow_code), },
+ };
+ #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[] = {"", "", "", "allow_code", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "dump",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *value;
PyObject *file;
int version = Py_MARSHAL_VERSION;
+ int allow_code = 1;
- if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
value = args[0];
file = args[1];
if (nargs < 3) {
- goto skip_optional;
+ goto skip_optional_posonly;
}
- version = _PyLong_AsInt(args[2]);
+ noptargs--;
+ version = PyLong_AsInt(args[2]);
if (version == -1 && PyErr_Occurred()) {
goto exit;
}
-skip_optional:
- return_value = marshal_dump_impl(module, value, file, version);
+skip_optional_posonly:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ allow_code = PyObject_IsTrue(args[3]);
+ if (allow_code < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
+ return_value = marshal_dump_impl(module, value, file, version, allow_code);
exit:
return return_value;
}
PyDoc_STRVAR(marshal_load__doc__,
-"load($module, file, /)\n"
+"load($module, file, /, *, allow_code=True)\n"
"--\n"
"\n"
"Read one value from the open file and return it.\n"
"\n"
" file\n"
" Must be readable binary file.\n"
+" allow_code\n"
+" Allow to load code objects.\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"
@@ -76,10 +118,66 @@ PyDoc_STRVAR(marshal_load__doc__,
"dump(), load() will substitute None for the unmarshallable type.");
#define MARSHAL_LOAD_METHODDEF \
- {"load", (PyCFunction)marshal_load, METH_O, marshal_load__doc__},
+ {"load", _PyCFunction_CAST(marshal_load), METH_FASTCALL|METH_KEYWORDS, marshal_load__doc__},
+
+static PyObject *
+marshal_load_impl(PyObject *module, PyObject *file, int allow_code);
+
+static PyObject *
+marshal_load(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(allow_code), },
+ };
+ #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[] = {"", "allow_code", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "load",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+ PyObject *file;
+ int allow_code = 1;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ file = args[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ allow_code = PyObject_IsTrue(args[1]);
+ if (allow_code < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
+ return_value = marshal_load_impl(module, file, allow_code);
+
+exit:
+ return return_value;
+}
PyDoc_STRVAR(marshal_dumps__doc__,
-"dumps($module, value, version=version, /)\n"
+"dumps($module, value, version=version, /, *, allow_code=True)\n"
"--\n"
"\n"
"Return the bytes object that would be written to a file by dump(value, file).\n"
@@ -88,70 +186,150 @@ PyDoc_STRVAR(marshal_dumps__doc__,
" Must be a supported type.\n"
" version\n"
" Indicates the data format that dumps should use.\n"
+" allow_code\n"
+" Allow to write code objects.\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__},
+ {"dumps", _PyCFunction_CAST(marshal_dumps), METH_FASTCALL|METH_KEYWORDS, marshal_dumps__doc__},
static PyObject *
-marshal_dumps_impl(PyObject *module, PyObject *value, int version);
+marshal_dumps_impl(PyObject *module, PyObject *value, int version,
+ int allow_code);
static PyObject *
-marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+marshal_dumps(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(allow_code), },
+ };
+ #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[] = {"", "", "allow_code", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "dumps",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *value;
int version = Py_MARSHAL_VERSION;
+ int allow_code = 1;
- if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
value = args[0];
if (nargs < 2) {
- goto skip_optional;
+ goto skip_optional_posonly;
}
- version = _PyLong_AsInt(args[1]);
+ noptargs--;
+ version = PyLong_AsInt(args[1]);
if (version == -1 && PyErr_Occurred()) {
goto exit;
}
-skip_optional:
- return_value = marshal_dumps_impl(module, value, version);
+skip_optional_posonly:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ allow_code = PyObject_IsTrue(args[2]);
+ if (allow_code < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
+ return_value = marshal_dumps_impl(module, value, version, allow_code);
exit:
return return_value;
}
PyDoc_STRVAR(marshal_loads__doc__,
-"loads($module, bytes, /)\n"
+"loads($module, bytes, /, *, allow_code=True)\n"
"--\n"
"\n"
"Convert the bytes-like object to a value.\n"
"\n"
+" allow_code\n"
+" Allow to load code objects.\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__},
+ {"loads", _PyCFunction_CAST(marshal_loads), METH_FASTCALL|METH_KEYWORDS, marshal_loads__doc__},
static PyObject *
-marshal_loads_impl(PyObject *module, Py_buffer *bytes);
+marshal_loads_impl(PyObject *module, Py_buffer *bytes, int allow_code);
static PyObject *
-marshal_loads(PyObject *module, PyObject *arg)
+marshal_loads(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(allow_code), },
+ };
+ #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[] = {"", "allow_code", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "loads",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer bytes = {NULL, NULL};
+ int allow_code = 1;
- if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
- if (!PyBuffer_IsContiguous(&bytes, 'C')) {
- _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(args[0], &bytes, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ allow_code = PyObject_IsTrue(args[1]);
+ if (allow_code < 0) {
goto exit;
}
- return_value = marshal_loads_impl(module, &bytes);
+skip_optional_kwonly:
+ return_value = marshal_loads_impl(module, &bytes, allow_code);
exit:
/* Cleanup for bytes */
@@ -161,4 +339,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=12082d61d2942473 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1575b9a3ae48ad3d input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/sysmodule.c.h b/contrib/tools/python3/Python/clinic/sysmodule.c.h
index e46c01e1e54..8277d286cf5 100644
--- a/contrib/tools/python3/Python/clinic/sysmodule.c.h
+++ b/contrib/tools/python3/Python/clinic/sysmodule.c.h
@@ -3,10 +3,10 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(sys_addaudithook__doc__,
"addaudithook($module, /, hook)\n"
@@ -282,9 +282,6 @@ sys_intern(PyObject *module, PyObject *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);
@@ -292,8 +289,54 @@ exit:
return return_value;
}
+PyDoc_STRVAR(sys__is_interned__doc__,
+"_is_interned($module, string, /)\n"
+"--\n"
+"\n"
+"Return True if the given string is \"interned\".");
+
+#define SYS__IS_INTERNED_METHODDEF \
+ {"_is_interned", (PyCFunction)sys__is_interned, METH_O, sys__is_interned__doc__},
+
+static int
+sys__is_interned_impl(PyObject *module, PyObject *string);
+
+static PyObject *
+sys__is_interned(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *string;
+ int _return_value;
+
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("_is_interned", "argument", "str", arg);
+ goto exit;
+ }
+ string = arg;
+ _return_value = sys__is_interned_impl(module, string);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(sys_settrace__doc__,
+"settrace($module, function, /)\n"
+"--\n"
+"\n"
+"Set the global debug tracing function.\n"
+"\n"
+"It will be called on each function call. See the debugger chapter\n"
+"in the library manual.");
+
+#define SYS_SETTRACE_METHODDEF \
+ {"settrace", (PyCFunction)sys_settrace, METH_O, sys_settrace__doc__},
+
PyDoc_STRVAR(sys__settraceallthreads__doc__,
-"_settraceallthreads($module, arg, /)\n"
+"_settraceallthreads($module, function, /)\n"
"--\n"
"\n"
"Set the global debug tracing function in all running threads belonging to the current interpreter.\n"
@@ -324,14 +367,26 @@ sys_gettrace(PyObject *module, PyObject *Py_UNUSED(ignored))
return sys_gettrace_impl(module);
}
+PyDoc_STRVAR(sys_setprofile__doc__,
+"setprofile($module, function, /)\n"
+"--\n"
+"\n"
+"Set the profiling function.\n"
+"\n"
+"It will be called on each function call and return. See the profiler\n"
+"chapter in the library manual.");
+
+#define SYS_SETPROFILE_METHODDEF \
+ {"setprofile", (PyCFunction)sys_setprofile, METH_O, sys_setprofile__doc__},
+
PyDoc_STRVAR(sys__setprofileallthreads__doc__,
-"_setprofileallthreads($module, arg, /)\n"
+"_setprofileallthreads($module, function, /)\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.");
+"It will be called on each function call and return. See the profiler\n"
+"chapter in the library manual.");
#define SYS__SETPROFILEALLTHREADS_METHODDEF \
{"_setprofileallthreads", (PyCFunction)sys__setprofileallthreads, METH_O, sys__setprofileallthreads__doc__},
@@ -447,7 +502,7 @@ sys_setrecursionlimit(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_limit;
- new_limit = _PyLong_AsInt(arg);
+ new_limit = PyLong_AsInt(arg);
if (new_limit == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -510,7 +565,7 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args,
if (!args) {
goto exit;
}
- depth = _PyLong_AsInt(args[0]);
+ depth = PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -678,7 +733,7 @@ sys_setdlopenflags(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_val;
- new_val = _PyLong_AsInt(arg);
+ new_val = PyLong_AsInt(arg);
if (new_val == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -733,7 +788,7 @@ sys_mdebug(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- flag = _PyLong_AsInt(arg);
+ flag = PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -811,7 +866,7 @@ sys_set_int_max_str_digits(PyObject *module, PyObject *const *args, Py_ssize_t n
if (!args) {
goto exit;
}
- maxdigits = _PyLong_AsInt(args[0]);
+ maxdigits = PyLong_AsInt(args[0]);
if (maxdigits == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1012,7 +1067,7 @@ sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- depth = _PyLong_AsInt(args[0]);
+ depth = PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1140,6 +1195,24 @@ sys__clear_type_cache(PyObject *module, PyObject *Py_UNUSED(ignored))
return sys__clear_type_cache_impl(module);
}
+PyDoc_STRVAR(sys__clear_internal_caches__doc__,
+"_clear_internal_caches($module, /)\n"
+"--\n"
+"\n"
+"Clear all internal performance-related caches.");
+
+#define SYS__CLEAR_INTERNAL_CACHES_METHODDEF \
+ {"_clear_internal_caches", (PyCFunction)sys__clear_internal_caches, METH_NOARGS, sys__clear_internal_caches__doc__},
+
+static PyObject *
+sys__clear_internal_caches_impl(PyObject *module);
+
+static PyObject *
+sys__clear_internal_caches(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return sys__clear_internal_caches_impl(module);
+}
+
PyDoc_STRVAR(sys_is_finalizing__doc__,
"is_finalizing($module, /)\n"
"--\n"
@@ -1164,7 +1237,7 @@ PyDoc_STRVAR(sys__stats_on__doc__,
"_stats_on($module, /)\n"
"--\n"
"\n"
-"Turns on stats gathering (stats gathering is on by default).");
+"Turns on stats gathering (stats gathering is off by default).");
#define SYS__STATS_ON_METHODDEF \
{"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__},
@@ -1186,7 +1259,7 @@ PyDoc_STRVAR(sys__stats_off__doc__,
"_stats_off($module, /)\n"
"--\n"
"\n"
-"Turns off stats gathering (stats gathering is on by default).");
+"Turns off stats gathering (stats gathering is off by default).");
#define SYS__STATS_OFF_METHODDEF \
{"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__},
@@ -1230,18 +1303,30 @@ PyDoc_STRVAR(sys__stats_dump__doc__,
"_stats_dump($module, /)\n"
"--\n"
"\n"
-"Dump stats to file, and clears the stats.");
+"Dump stats to file, and clears the stats.\n"
+"\n"
+"Return False if no statistics were not dumped because stats gathering was off.");
#define SYS__STATS_DUMP_METHODDEF \
{"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__},
-static PyObject *
+static int
sys__stats_dump_impl(PyObject *module);
static PyObject *
sys__stats_dump(PyObject *module, PyObject *Py_UNUSED(ignored))
{
- return sys__stats_dump_impl(module);
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = sys__stats_dump_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
}
#endif /* defined(Py_STATS) */
@@ -1401,7 +1486,7 @@ sys__getframemodulename(PyObject *module, PyObject *const *args, Py_ssize_t narg
if (!noptargs) {
goto skip_optional_pos;
}
- depth = _PyLong_AsInt(args[0]);
+ depth = PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1412,6 +1497,80 @@ exit:
return return_value;
}
+PyDoc_STRVAR(sys__get_cpu_count_config__doc__,
+"_get_cpu_count_config($module, /)\n"
+"--\n"
+"\n"
+"Private function for getting PyConfig.cpu_count");
+
+#define SYS__GET_CPU_COUNT_CONFIG_METHODDEF \
+ {"_get_cpu_count_config", (PyCFunction)sys__get_cpu_count_config, METH_NOARGS, sys__get_cpu_count_config__doc__},
+
+static int
+sys__get_cpu_count_config_impl(PyObject *module);
+
+static PyObject *
+sys__get_cpu_count_config(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = sys__get_cpu_count_config_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(sys__baserepl__doc__,
+"_baserepl($module, /)\n"
+"--\n"
+"\n"
+"Private function for getting the base REPL");
+
+#define SYS__BASEREPL_METHODDEF \
+ {"_baserepl", (PyCFunction)sys__baserepl, METH_NOARGS, sys__baserepl__doc__},
+
+static PyObject *
+sys__baserepl_impl(PyObject *module);
+
+static PyObject *
+sys__baserepl(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return sys__baserepl_impl(module);
+}
+
+PyDoc_STRVAR(sys__is_gil_enabled__doc__,
+"_is_gil_enabled($module, /)\n"
+"--\n"
+"\n"
+"Return True if the GIL is currently enabled and False otherwise.");
+
+#define SYS__IS_GIL_ENABLED_METHODDEF \
+ {"_is_gil_enabled", (PyCFunction)sys__is_gil_enabled, METH_NOARGS, sys__is_gil_enabled__doc__},
+
+static int
+sys__is_gil_enabled_impl(PyObject *module);
+
+static PyObject *
+sys__is_gil_enabled(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = sys__is_gil_enabled_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
#ifndef SYS_GETWINDOWSVERSION_METHODDEF
#define SYS_GETWINDOWSVERSION_METHODDEF
#endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */
@@ -1455,4 +1614,4 @@ exit:
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=2a1fbdf7de450c63 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9cc9069aef1482bc input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Python/clinic/traceback.c.h b/contrib/tools/python3/Python/clinic/traceback.c.h
index 3c344934971..fe53a2786d1 100644
--- a/contrib/tools/python3/Python/clinic/traceback.c.h
+++ b/contrib/tools/python3/Python/clinic/traceback.c.h
@@ -3,13 +3,13 @@ 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()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(tb_new__doc__,
-"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
+"traceback(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
"--\n"
"\n"
"Create a new traceback object.");
@@ -43,7 +43,7 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL};
static _PyArg_Parser _parser = {
.keywords = _keywords,
- .fname = "TracebackType",
+ .fname = "traceback",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
@@ -61,15 +61,15 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
}
tb_next = fastargs[0];
if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
- _PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
+ _PyArg_BadArgument("traceback", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
goto exit;
}
tb_frame = (PyFrameObject *)fastargs[1];
- tb_lasti = _PyLong_AsInt(fastargs[2]);
+ tb_lasti = PyLong_AsInt(fastargs[2]);
if (tb_lasti == -1 && PyErr_Occurred()) {
goto exit;
}
- tb_lineno = _PyLong_AsInt(fastargs[3]);
+ tb_lineno = PyLong_AsInt(fastargs[3]);
if (tb_lineno == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -78,4 +78,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=7bc9927e362fdfb7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=916a759875507c5a input=a9049054013a1b77]*/