Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
bpo-45753: Move function object struct to an internal header.#29516
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
bpo-45753: Move function object struct to an internal header.#29516
Uh oh!
There was an error while loading.Please reload this page.
Conversation
4e4def7
to7c3738d
Comparecfa7d3e
to2b0075c
CompareNot part of the stable ABI, but since it was exposed in the C-API, I expect that people are using it. Thebackwards compatibility policy applies. |
The struct is exposed in a header file, but that doesn't make it part of the C API. I've said it before, and I'll say it again: the fields of a struct cannot be part of an API, unless that struct is used as an input to an API function, and even in that case, the meaning of those fields must be documented. Fishing fields out of a struct has no meaning unless the meaning of those fields is documented. |
Whatis the C API, then? |
The problem is that source/headers cannot define an API by themselves. An API is not just syntax, it is semantics as well. Why is this not the definition of the C API?https://docs.python.org/3/c-api/index.html |
Right, so you'd also look how CPython uses the API. AFAIK, that's historically how you'd use the underdocumented parts of the API. As for the "Porting to Python 3.11" section in What's new, I think we should write for a target audience of someone who's inherited an old dusty C extension, and needs to port it without knowing much about the C-API (andespecially the undocumented parts). I suggest writing something forany change of API that's been around for a decade – even if it's private. |
Ok, this is more controversial than I had hoped. |
Thanks. Getting other opinions sounds like the right thing. |
A PEP to make PyThreadState and PyFrameObject opaque sounds like a good idea. I expect less users of PyFunctionObject, but I didn't look at this structure yet. I'm working on making these structures for 2 years :-)
|
IMO a PEP is a good way to ask for an exception for the PEP 387 policy ;-) So we can consider to implement such PEP in Python 3.11. |
Uh oh!
There was an error while loading.Please reload this page.
The layout of the function object struct should not be exposed in the API. It is not part of the ABI.
We will want to change the layout to improve performance of Python-to-Python calls and other purposes, and having it in a public header prevents us from doing that.
@encukou does this seem OK to you?
https://bugs.python.org/issue45753