Skip to content

Support setting tp_vectorcall for heap types #100554

Closed
@davidhewitt

Description

@davidhewitt

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 for PyType_FromSpec or read using PyType_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 with PyType_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions