Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-143361: Pass PY_VECTORCALL_ARGUMENTS_OFFSET in _Py_CallBuiltinClass_StackRefSteal#143367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Misc/NEWS.d/next/Core_and_Builtins/2026-01-02-17-11-16.gh-issue-143361.YDnvdC.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-143361.YDnvdC.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think we need this, this is internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I mentally went back and forth on this. It's true that guideline is that "strictly internal changes with no user-visible effects" do not warrant an entry. My reasoning for inclusion was that a 3.9% speedup in a core code path is indeed significant enough to external, end-users that this change warrants an entry. It also seems to be how this sort of change inceval.c. has been handled in the past. However, I’ll gladly defer to the guidance of the core developers who review the PR.
b538c28 intopython:mainUh oh!
There was an error while loading.Please reload this page.
This PR fixes a missed optimization.
The function
_Py_CallBuiltinClass_StackRefStealusesSTACKREFS_TO_PYOBJECTS. However, the code was not passing thePY_VECTORCALL_ARGUMENTS_OFFSETflag to the callee. This forced vector-callable types to reallocate and copy the arguments whenever they needed to prepend an argument.Verification
Using LLDB to inspect
long_vectorcallwhen reached via this path:nargsf = 1nargsf = 0x8000000000000001(High bit correctly set)Benchmarks
I ran a small benchmark file allocating a class in a tight loop to trigger the path:
gh-143361
Benchmark script