From: Aaron Wieczorek Date: Fri, 2 Jan 2026 20:43:00 +0000 (+0000) Subject: gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal... X-Git-Tag: v3.15.0a5~11^2~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b538c2832d582a428a6f4ddc818680c5e05a0745;p=thirdparty%2FPython%2Fcpython.git gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal (GH-143367) Co-authored-by: Aaron Wieczorek --- 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 index 000000000000..df4e3b61c672 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-02-17-11-16.gh-issue-143361.YDnvdC.rst @@ -0,0 +1,2 @@ +Add ``PY_VECTORCALL_ARGUMENTS_OFFSET`` to ``_Py_CallBuiltinClass_StackRefSteal`` to +avoid redundant allocations diff --git a/Python/ceval.c b/Python/ceval.c index 924afaa97443..d90ac5c69b9e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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: