Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-39245: Make Vectorcall public #17893
Conversation
Change made automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyObject_FastCallDict \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done
Mark all newly public functions as added in 3.9. Add a note about the 3.8 provisional names. Add notes on public API.
This comment has been minimized.
This comment has been minimized.
The problem is that
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hmm, I see I misunderstood the bpo-37194 conversation. I see now that you were talking about the limited API (stable ABI) when you said "public". |
This comment has been minimized.
This comment has been minimized.
The main reasons for excluding things from the stable API/ABI is if we think they might be difficult for other implementations to provide, or if they're intrinsically exposed to ABI compatibility issues.
|
This comment has been minimized.
This comment has been minimized.
Yes, I consider that it is safe to add it to the stable ABI, since it should be trivial to implement. |
Before making the API public, I would like to see a public discussion if we should pass tstate to functions or not (change the calling convention). For subinterpreters, we will need more and more to access tstate. There are ways to get the tstate, but they may be "inefficient" when calling very frequently. @ericsnowcurrently: What do you think? |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 8, 2020
When you're done making the requested changes, leave the comment: |
This comment has been minimized.
This comment has been minimized.
Got it! Thanks for explaining and sorry for the misunderstanding.
I think that's a good change, but I don't think I'll have time myself to do that for 3.9. The vectorcall API should be added in 3.9, but it can still be changed before the final release. (If it is, I'd prefer the underscored versions to stay as they are for 3.8 compatibility.) This PR touches a lot of files; if it's open for a long time it might need to be rebased often. Can we not block this on the tstate discussion? |
This comment has been minimized.
This comment has been minimized.
I started a thread on python-dev: https://mail.python.org/archives/list/python-dev@python.org/thread/PIXJAJPWKDGHSQD65VOO2B7FDLU2QLHH/ If we agree that it's a good idea to pass tstate a part of VECTORCALL, I can work on the actual implementation. |
This comment has been minimized.
This comment has been minimized.
Why must this be done before this PR is merged? |
This comment has been minimized.
This comment has been minimized.
There are two open questions:
Early answers on python-dev are that the calling convention should be modified, but the public C API should not include tstate (passed implicitly if the calling convention is changed). We can use a private C API which accepts a tstate. So far, these questions don't seem to block this PR. Changing the calling convention can be done later. For the private C API with tstate parameter, I added for example |
This comment has been minimized.
This comment has been minimized.
That's my impression as well.
If the calling convention passes tstate explicitly, it would make sense to make |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 10, 2020
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
encukou commentedJan 7, 2020
•
edited by bedevere-bot
As per PEP-590, in Python 3.9 the Vectorcall API will be public, i.e. without leading underscores.
This PR also includes some other new call API that got added together with vectorcall.
@vstinner, note that this partially reverts commit 2ff58a2 : IMO
PyObject_CallNoArgs
should always stay behind#ifndef Py_LIMITED_API
(i.e. be inInclude/cpython/
).https://bugs.python.org/issue39245