]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal...
authorAaron Wieczorek <aaronw@fastmail.com>
Fri, 2 Jan 2026 20:43:00 +0000 (20:43 +0000)
committerGitHub <noreply@github.com>
Fri, 2 Jan 2026 20:43:00 +0000 (20:43 +0000)
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
Misc/NEWS.d/next/Core_and_Builtins/2026-01-02-17-11-16.gh-issue-143361.YDnvdC.rst [new file with mode: 0644]
Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-02-17-11-16.gh-issue-143361.YDnvdC.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-02-17-11-16.gh-issue-143361.YDnvdC.rst
new file mode 100644 (file)
index 0000000..df4e3b6
--- /dev/null
@@ -0,0 +1,2 @@
+Add ``PY_VECTORCALL_ARGUMENTS_OFFSET`` to ``_Py_CallBuiltinClass_StackRefSteal`` to
+avoid redundant allocations
index 924afaa97443cb40c201eb1d36a31894b64706cf..d90ac5c69b9e81910fbce430df41885fd71cb7ca 100644 (file)
@@ -1273,7 +1273,7 @@ _Py_CallBuiltinClass_StackRefSteal(
         goto cleanup;
     }
     PyTypeObject *tp = (PyTypeObject *)PyStackRef_AsPyObjectBorrow(callable);
-    res = tp->tp_vectorcall((PyObject *)tp, args_o, total_args, NULL);
+    res = tp->tp_vectorcall((PyObject *)tp, args_o, total_args | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
     STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
     assert((res != NULL) ^ (PyErr_Occurred() != NULL));
 cleanup: