-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support setting tp_vectorcall
for heap types
#100554
Comments
Just so everyone reading this is on the same page, this is about more efficient calling of the type, not of instances. I haven't checked if implementing See devguide and vectorcall_limited for how to add tests for this. (If it doesn't make it into 3.12 it'll need to be in a seprarte file.) The tests should show that it's possible to correctly use the feature with limited API, as well as cover any edge cases. |
I'd like to second this feature request. I was just looking into using vector calls to accelerate object construction for nanobind and realized that it's not possible in the stable API because of the missing type slot. |
…torcall`` using the ``PyType_FromSpec`` function family. (#123332)
Feature or enhancement
The
tp_vectorcall
slot can be used with static types to define a more efficient implementation of__new__
/__init__
. This slot does not have a typedef in typeslots.h, so it cannot currently be set forPyType_FromSpec
or read usingPyType_GetSlot
.In 3.12 other vectorcall functionality looks set to stabilise, so please consider adding a
Py_tp_vectorcall
typedef and allow heap types to set / get this member.Pitch
Adding the ability for
tp_vectorcall
to be used in the limited API enables extension types to make use of the vectorcall optimisation in more functionality.Previous discussion
I see in #85784 that
tp_vectorcall
is deliberately inaccessible withPyType_GetSlot
because it is not part of the limited API.If there is support for this proposal, I am happy to have a first stab at implementation.
Linked PRs
Py_tp_vectorcall
slot to setPyTypeObject.tp_vectorcall
using thePyType_FromSpec
function family. #123332The text was updated successfully, but these errors were encountered: