From 7ce03dc63d5c4640ba14b5d23537b1c85ebb490f Mon Sep 17 00:00:00 2001 From: Shamil Abdulaev Date: Mon, 26 Oct 2026 12:09:58 +0300 Subject: [PATCH 1/2] refactor(ceval): combine argument conversion loops --- .../2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst | 2 ++ Python/ceval.c | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst new file mode 100644 index 000000000000000..e2ac02522689b04 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst @@ -0,0 +1,2 @@ +Combine the positional and keyword argument conversion loops in +``_PyEval_Vector`` into a single loop. Patch by Shamil Abdulaev. diff --git a/Python/ceval.c b/Python/ceval.c index 223106065c603c4..aba8d2c0c762edf 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2242,15 +2242,9 @@ _PyEval_Vector(PyThreadState *tstate, PyFunctionObject *func, /* _PyEvalFramePushAndInit consumes the references * to func, locals and all its arguments */ Py_XINCREF(locals); - for (size_t i = 0; i < argcount; i++) { + for (size_t i = 0; i < total_args; i++) { arguments[i] = PyStackRef_FromPyObjectNew(args[i]); } - if (kwnames) { - Py_ssize_t kwcount = PyTuple_GET_SIZE(kwnames); - for (Py_ssize_t i = 0; i < kwcount; i++) { - arguments[i+argcount] = PyStackRef_FromPyObjectNew(args[i+argcount]); - } - } _PyInterpreterFrame *frame = _PyEvalFramePushAndInit( tstate, PyStackRef_FromPyObjectNew(func), locals, arguments, argcount, kwnames, NULL); From e9afaf9b571cb9ab67631dcfac07244ee802237b Mon Sep 17 00:00:00 2001 From: Shamil Abdulaev Date: Thu, 29 Oct 2026 09:45:27 +0300 Subject: [PATCH 2/2] choore(docs): remove news --- .../2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst deleted file mode 100644 index e2ac02522689b04..000000000000000 --- a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-26-11-58-58.gh-issue-160679.j2QxVr.rst +++ /dev/null @@ -1,2 +0,0 @@ -Combine the positional and keyword argument conversion loops in -``_PyEval_Vector`` into a single loop. Patch by Shamil Abdulaev.