You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation about PyTypeObject being part of the Stable ABI #95300
changed the title [-]Documentation about PyTypeObject being part of the stable ABI[/-][+]Documentation about PyTypeObject being part of the Stable ABI[/+]on Jul 26, 2022
Technically PyTypeObject is 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".
It's both.
In the limited API/stable ABI, PyTypeObject is opaque (and has been since the beginning). The ABI for an opaque struct is just a pointer, so there's nothing specific to PyTypeObject in the Stable ABI.
(The first part of PyTypeObject happens to be stable across releases, but that's because it's needed for declarations without designated initializers using the regular C- API.)
@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.)
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 PyTypeObject being 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:
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…