Skip to content

Commit b538c28

Browse files
a12kAaron Wieczorek
andauthored
gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal (GH-143367)
Co-authored-by: Aaron Wieczorek <woz@Aarons-MacBook-Pro.local>
1 parent 136f6d8 commit b538c28

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add ``PY_VECTORCALL_ARGUMENTS_OFFSET`` to ``_Py_CallBuiltinClass_StackRefSteal`` to
2+
avoid redundant allocations

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ _Py_CallBuiltinClass_StackRefSteal(
12731273
goto cleanup;
12741274
}
12751275
PyTypeObject *tp = (PyTypeObject *)PyStackRef_AsPyObjectBorrow(callable);
1276-
res = tp->tp_vectorcall((PyObject *)tp, args_o, total_args, NULL);
1276+
res = tp->tp_vectorcall((PyObject *)tp, args_o, total_args | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
12771277
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
12781278
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
12791279
cleanup:

0 commit comments

Comments
 (0)