Skip to content
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

Expose Py_tp_vectorcall in the limited API #41

Closed
6 tasks done
encukou opened this issue Aug 27, 2024 · 6 comments
Closed
6 tasks done

Expose Py_tp_vectorcall in the limited API #41

encukou opened this issue Aug 27, 2024 · 6 comments
Labels

Comments

@encukou
Copy link
Collaborator

encukou commented Aug 27, 2024

tp_vectorcall is somewhat tricky to understand, but can bring significant speedups to wrapper code.

In python/cpython#100554, pybind11 and PyO3 maintainers ask to expose it for use with PyType_FromSpec/PyType_GetSlot and in limited API, and Wenzel sent a PR recently.

tp_vectorcall needs to match the behavior of a metaclass call, so exposing tp_vectorcall limits future changes to PyType_Type->tp_call. But, I think that's already something we can't really change.

Does a Py_tp_vectorcall slot sound reasonable?

@vstinner
Copy link

Does a Py_tp_vectorcall slot sound reasonable?

We added vectorcall to multiple types successfully, it made creation of objects faster. So yes, it makes sense.

@zooba
Copy link

zooba commented Aug 27, 2024

I disagree with vector call being part of the stable ABI at all, but since that's apparently already been done, then I see no reason to oppose adding a constant that should've been there from the start.

@encukou
Copy link
Collaborator Author

encukou commented Sep 3, 2024

@erlend-aasland @mdboom @serhiy-storchaka, what's your opinion?

@encukou encukou added the vote label Sep 10, 2024
@encukou
Copy link
Collaborator Author

encukou commented Sep 13, 2024

@serhiy-storchaka, do you have any reservations?

@serhiy-storchaka
Copy link

The vectorcall protocol was added to the Limited API in 3.12. It is too late to change anything here. Not exposing Py_tp_vectorcall looks like omission.

@encukou
Copy link
Collaborator Author

encukou commented Sep 13, 2024

Thanks for the votes!

@encukou encukou closed this as completed Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants