diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-11-08 05:41:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-08 05:41:54 (GMT) |
commit | 06a8b0bb5ee0d01ed93315137c41c104a11e4640 (patch) | |
tree | ac2d8c1fe90ecba50c2dfc3e74fa79af7cd7a067 /Python | |
parent | c222441fa7f89d448e476c252ba09be588568392 (diff) | |
download | cpython-06a8b0bb5ee0d01ed93315137c41c104a11e4640.zip cpython-06a8b0bb5ee0d01ed93315137c41c104a11e4640.tar.gz cpython-06a8b0bb5ee0d01ed93315137c41c104a11e4640.tar.bz2 |
gh-122943: Remove the object converter for var-positional parameter (GH-126560)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 13 | ||||
-rw-r--r-- | Python/clinic/bltinmodule.c.h | 22 |
2 files changed, 16 insertions, 19 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 85a28de..a3f4119 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2127,7 +2127,7 @@ builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp, /*[clinic input] print as builtin_print - *args: object + *args: array sep: object(c_default="Py_None") = ' ' string inserted between values, default a space. end: object(c_default="Py_None") = '\n' @@ -2142,9 +2142,10 @@ Prints the values to a stream, or to sys.stdout by default. [clinic start generated code]*/ static PyObject * -builtin_print_impl(PyObject *module, PyObject *args, PyObject *sep, - PyObject *end, PyObject *file, int flush) -/*[clinic end generated code: output=3cfc0940f5bc237b input=c143c575d24fe665]*/ +builtin_print_impl(PyObject *module, PyObject * const *args, + Py_ssize_t args_length, PyObject *sep, PyObject *end, + PyObject *file, int flush) +/*[clinic end generated code: output=3cb7e5b66f1a8547 input=66ea4de1605a2437]*/ { int i, err; @@ -2181,7 +2182,7 @@ builtin_print_impl(PyObject *module, PyObject *args, PyObject *sep, return NULL; } - for (i = 0; i < PyTuple_GET_SIZE(args); i++) { + for (i = 0; i < args_length; i++) { if (i > 0) { if (sep == NULL) { err = PyFile_WriteString(" ", file); @@ -2193,7 +2194,7 @@ builtin_print_impl(PyObject *module, PyObject *args, PyObject *sep, return NULL; } } - err = PyFile_WriteObject(PyTuple_GET_ITEM(args, i), file, Py_PRINT_RAW); + err = PyFile_WriteObject(args[i], file, Py_PRINT_RAW); if (err) { return NULL; } diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index b472796..39a23f0 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -7,7 +7,6 @@ preserve # include "pycore_runtime.h" // _Py_ID() #endif #include "pycore_modsupport.h" // _PyArg_UnpackKeywords() -#include "pycore_tuple.h" // _PyTuple_FromArray() PyDoc_STRVAR(builtin___import____doc__, "__import__($module, /, name, globals=None, locals=None, fromlist=(),\n" @@ -902,8 +901,9 @@ PyDoc_STRVAR(builtin_print__doc__, {"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); +builtin_print_impl(PyObject *module, PyObject * const *args, + Py_ssize_t args_length, PyObject *sep, PyObject *end, + PyObject *file, int flush); static PyObject * builtin_print(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) @@ -937,7 +937,8 @@ builtin_print(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec PyObject *argsbuf[4]; PyObject * const *fastargs; Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; - PyObject *__clinic_args = NULL; + PyObject * const *__clinic_args; + Py_ssize_t args_length; PyObject *sep = Py_None; PyObject *end = Py_None; PyObject *file = Py_None; @@ -973,16 +974,11 @@ builtin_print(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec goto exit; } skip_optional_kwonly: - __clinic_args = _PyTuple_FromArray(args, nargs); - if (__clinic_args == NULL) { - goto exit; - } - return_value = builtin_print_impl(module, __clinic_args, sep, end, file, flush); + __clinic_args = args; + args_length = nargs; + return_value = builtin_print_impl(module, __clinic_args, args_length, sep, end, file, flush); exit: - /* Cleanup for args */ - Py_XDECREF(__clinic_args); - return return_value; } @@ -1235,4 +1231,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) exit: return return_value; } -/*[clinic end generated code: output=76b27cf4164f257e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5c510ec462507656 input=a9049054013a1b77]*/ |