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 inconsistency with the stable ABI #91271
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-03-25.08:05:03.316>labels= ['docs']
title='Documentation inconsistency with the stable ABI'updated_at=<Date2022-04-06.14:50:59.105>user='https://github.com/thatbirdguythatuknownot'
I will split the latter into 1) structs that have a few fields exposed mainly for backwards compatibility (which, of course, is very important here). Best practice is to treat them as opaque (use getters/setters):
PyObject (ob_refcnt, ob_type)
PyVarObject (ob_base, ob_size)
... and 2) structs for which all fields are part of the ABI (and the struct's size as well: for most of these as users are expected to provide arrays):
Activity
thatbirdguythatuknownot commentedon Mar 25, 2022
In https://docs.python.org/3/c-api/typeobj.html#static-types, it says that PyTypeObject isn't part of the stable ABI. Yet, in https://docs.python.org/3/c-api/type.html#c.PyTypeObject, it says that PyTypeObject IS part of the stable ABI. Which is true?
encukou commentedon Mar 28, 2022
Thanks for the report! You're right that this is misleading. I'll clarify the docs for this and other structs.
encukou commentedon Mar 30, 2022
So. According to PEP-384 (which added all structs in the stable ABI, except Py_buffer), some structs are opaque and others have a few members exposed:
https://peps.python.org/pep-0384/#structures
I will split the latter into 1) structs that have a few fields exposed mainly for backwards compatibility (which, of course, is very important here). Best practice is to treat them as opaque (use getters/setters):
... and 2) structs for which all fields are part of the ABI (and the struct's size as well: for most of these as users are expected to provide arrays):
The opaque structs continue to be:
encukou commentedon Apr 6, 2022
New changeset d79f118 by Petr Viktorin in branch 'main':
bpo-47115: Document which parts of structs are in limited API/stable ABI (GH-32196)
d79f118
gh-91271: Document which parts of structs are in limited API/stable A…
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. (p…
Clarify API stability of PyTypeObject in relation to static types. (G…
Clarify API stability of PyTypeObject in relation to static types. (G…