Uh oh!
There was an error while loading. Please reload this page.
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h - #99014
Conversation
Old names are kept as aliases.
These docs were ripe for an overhaul, so I did one when touching the code.
encukou
commented
Nov 7, 2022
Today I noticed the style guide says macros should have the |
encukou
commented
Nov 8, 2022
And by the same token, |
encukou
commented
Nov 16, 2022
And here are tests. |
bedevere-bot
commented
Nov 16, 2022
erlend-aasland
left a comment
There was a problem hiding this comment.
Looks good. I did some nitpicking.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Nov 21, 2022
Thank you! I did the changes, and will merge once everything is green. |
vstinner
commented
Nov 22, 2022
Nice work! |
Uh oh!
There was an error while loading. Please reload this page.
serhiy-storchaka
commented
Jul 25, 2023
Isn't it strange that the only public constant for object has an |
vstinner
commented
Jul 25, 2023
I agree that
By the way, how was
|
serhiy-storchaka
commented
Jul 25, 2023
Both T_NONE was introduced in 50e9fb9. I have not found a single case of its use. |
vstinner
commented
Jul 25, 2023
Maybe it's not worth it to add |
encukou
commented
Aug 2, 2023
|
The
structmember.hheader is deprecated, though it continues to be available and there are no plans to remove it. There are no deprecation warnings. Old code can stay unchanged (unless the extra include and non-namespaced macros bother you greatly). Specifically, no uses in CPython are updated -- that would just be unnecessary churn.The header's contents are now available just by including
Python.h, with aPY_prefix added if it was missing:PyMemberDef,PyMember_GetOne,PyMember_SetOnePY_T_INT,PY_T_DOUBLE, etc. (previouslyT_INT,T_DOUBLE, etc.)PY_READONLY(previouslyREADONLY) andPY_AUDIT_READ(name unchanged)Several items are not exposed from
Python.h:T_OBJECT(usePY_T_OBJECT_EX)T_NONE(previously undocumented, and pretty quirky)WRITE_RESTRICTEDwhich does nothing.RESTRICTEDandREAD_RESTRICTED, equivalents ofPY_AUDIT_READ.<stddef.h>is not included fromPython.h.It should be included manually when using
offsetof().The
PY_T_*,PY_READONLYandPY_AUDIT_READmacros are added to the stable API manifest. This is just a clerical change, really -- Stable ABI extensions in the wild usestructmember.h, andPyMemberDef&Py_tp_membersare already listed.There is discussion on the issue to rename
T_PYSSIZETtoPY_T_SSIZEor similar. I chose not to do that -- users will probably copy/paste that with any spelling, and not renaming it makes migration docs simpler.Co-Authored-By: Alexander Belopolsky abalkin@users.noreply.github.com
Co-Authored-By: Matthias Braun MatzeB@users.noreply.github.com