Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-C-APItriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
https://docs.python.org/3/c-api/typeobj.html#static-types says:
Also, since PyTypeObject is not part of the stable ABI, any extension modules using static types must be compiled for a specific Python minor version.
https://docs.python.org/3/c-api/type.html#c.PyTypeObject says:
Part of the Stable ABI.
I'm not sure what needs to be fixed, but something does. Can extension modules using the Stable ABI use static types now?
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-C-APItriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
[-]Documentation about PyTypeObject being part of the stable ABI[/-][+]Documentation about PyTypeObject being part of the Stable ABI[/+]erlend-aasland commentedon Jul 26, 2022
The former quote should probably read Limited API, not Stable ABI. cc. @encukou
kumaraditya303 commentedon Jul 27, 2022
Technically
PyTypeObjectis part of the stable ABI as an opaque struct (whose fields are part of the ABI) because stable ABI uses Limited C API. Maybe it's better to just document it as "part of Limited C API as an opaque struct".encukou commentedon Jul 27, 2022
This is fixed in https://docs.python.org/3.11/c-api/type.html#c.PyTypeObject
But it would make sense to backport to earlier docs.
encukou commentedon Aug 5, 2022
PR is at #95711
ov2k commentedon Aug 5, 2022
I think https://docs.python.org/3/c-api/typeobj.html#static-types still needs to be fixed. https://docs.python.org/3/c-api/stable.html says:
It's not that
PyTypeObjectisn't part of the Stable ABI, but that its members aren't part of the Limited API.encukou commentedon Aug 8, 2022
It's both.
In the limited API/stable ABI,
PyTypeObjectis opaque (and has been since the beginning). The ABI for an opaque struct is just a pointer, so there's nothing specific toPyTypeObjectin the Stable ABI.(The first part of
PyTypeObjecthappens to be stable across releases, but that's because it's needed for declarations without designated initializers using the regular C- API.)erlend-aasland commentedon Aug 8, 2022
Suggesting to close this as fixed.
encukou commentedon Aug 8, 2022
@ov2k, please feel free to comment if you disagree, have other suggestions, or if something is unclear.
(Not sure if you have permission to reopen – if you do, that's also an option.)
ov2k commentedon Aug 11, 2022
That's exactly my point, but perhaps I wasn't being clear enough. https://docs.python.org/3/c-api/typeobj.html#static-types makes no reference to
PyTypeObjectbeing opaque, which is the real reason why extension modules using static types must be compiled for a specific Python minor version. It should say something like:encukou commentedon Aug 17, 2022
It makes sense to me, but I've been thinking about API/ABI way too much :)
Could you send a PR to make this clearer? If not I'll get to it eventually.
Clarify API stability of PyTypeObject in relation to static types. (p…
Clarify API stability of PyTypeObject in relation to static types. (p…
Clarify API stability of PyTypeObject in relation to static types. (G…
Clarify API stability of PyTypeObject in relation to static types. (G…
Clarify API stability of PyTypeObject in relation to static types. (p…