GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-47115: Document which parts of structs are in limited API/stable ABI by encukou · Pull Request #32196 · python/cpython Conversation
|
|
A side question since |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| opaque | ||
| struct PyFrameObject | ||
| added 3.2 | ||
| opaque |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
By the way, I recently added "The structure is not part of the C API." to:
https://docs.python.org/dev/c-api/frame.html
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That's wrong. If it's not part of the API at all, you can't use functions like PyFrame_GetBack that take it as an argument.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems like there is a misunderstanding on what "a structure" means here. Python C API is misleading because it uses short PyFrameObject type name rather than struct PyFrameObject.
In practice in C, "PyFrameObject" is a type name, not a structure. I recently added Include/pytypedefs.h to clarify which type names are always available in the C API (and fix a compiler error), even if their related structures are opaque. I understand that the type (type "name") is part of the C API, but the structure is not.
I'm not sure how https://docs.python.org/dev/c-api/frame.html should be rephrased. The follow this PR, maybe "The structure is opaque" which may become redundant once this PR is merged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see.
This should be explained/avoided: if you don't know the term "opaque structure" you are likely to search for it, but if you don't realize the distinction between "type" and "structure", you'll probably just be confused.
I'll work on the rephrasing next week. Please let me know if you know of other places with similar wording.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I started going through all the structs to make sure the docs make sense.
And I quite like the note for PyInterpreterState: “There are no public members in this structure.” Short and clear! I'll use that for PyFrameObject too.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is there a definition of an "opaque structure" in the Python doc? Is there a link from "opaque struct" in then generated doc? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
IMO it's a generally known term, it even has a Wikipedia entry. I don't think the docs need to define it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@arhadthedev, I'll open an issue for it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Issue for the renaming (and more): https://bugs.python.org/issue47168 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nice; I think this doc enhancement will be helpful for both core devs and others.
From what I could see, the Py changes look sensible, but I'm not at all familiar with these doc tools. I'll have another look at this tomorrow.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Erlend Egeberg Aasland <[email protected]>
|
So, how about this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
“There are no public members in this structure.” That's explicit. It prevents the confusion about "the structure is not part of the C API" and confusion between "structure" and "type". In practice, an opaque structure ... is an empty structure, right ;-) The only subtle difference is that sizeof() doesn't work on an opaque structure, but I don't think that it's worth it to do into the details, unless we add an entry to the glossary for "opaque structure". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me also.
It looks to me that this comment is now outdated:
cpython/Doc/tools/extensions/c_annotations.py
Lines 101 to 103 in 4b188ae
| # Stable ABI annotation. These have two forms: | |
| # Part of the [Stable ABI](link). | |
| # Part of the [Stable ABI](link) since version X.Y. |
Either update it or delete it :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Comment adjusted, and one more tweak to the wording: (It should be possible to make these -- PyObject & PyVarObject -- fully opaque in the 3.12 limited API.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ABI (pythonGH-32196) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
…BI (GH-32196) (GH-95711) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.