Skip to content

bpo-2897: Make PyMemberDef part of stable ABI; deprecate structmember.h #20462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

MatzeB
Copy link
Contributor

@MatzeB MatzeB commented May 27, 2020

Move PyMemberDef and related flags from structmember.h to descrobject.h.
Rename READONLY to PY_READONLY and READ_RESTRICTED to
PY_READ_RESTRICTED. This makes the structure part of the stable ABI.

Move PyMember_GetOne and PyMemberSetOne as well but do not make them
part of the stable ABI yet.

Document that structmember.h is deprecated, change examples and
documentation and add definitions for READONLY, READ_RESTRICTED,
PY_WRITE_RESTRICTED and RESTRICTED to it for backwards compatibility.

Add check for stddef.h to configure.ac because we need to include it for
offsetof and Python.h does not pass the HAVE_STDDEF_H check without it.

https://bugs.python.org/issue2897

Move PyMemberDef and related flags from structmember.h to descrobject.h.
Rename READONLY to PY_READONLY and READ_RESTRICTED to
PY_READ_RESTRICTED. This makes the structure part of the stable ABI.

Move PyMember_GetOne and PyMemberSetOne as well but do not make them
part of the stable ABI yet.

Document that structmember.h is deprecated, change examples and
documentation and add definitions for READONLY, READ_RESTRICTED,
PY_WRITE_RESTRICTED and RESTRICTED to it for backwards compatibility.

Add check for stddef.h to configure.ac because we need to include it for
offsetof and Python.h does not pass the HAVE_STDDEF_H check without it.
@tiran tiran removed their request for review April 17, 2021 21:23
@rhettinger rhettinger removed their request for review May 3, 2022 06:07
@encukou
Copy link
Member

encukou commented Oct 10, 2022

Hello. Sorry for the delay -- I just found this PR (I noticed the bug and wanted to file an issue myself).
Are you still interested in the PR, after 2 years?
If not, I'd be happy to take over.

  • Changing all the uses of READONLY to PY_READONLY (and removing the #include) isn't really necessary. The PR would be much easier to review without that, and there'd be fewer conflicts.
  • Everything included from Python.h should have the Py_ prefix, so T_* macros should be renamed to PY_T_*. The old header should continue to provide the old names.
    • The new constants should be documented and added to Misc/stable_abi.toml, but let's do that in a separate PR.
  • We should ensure we don't reuse PY_WRITE_RESTRICTED's value for something else in the future. So, in descrobject.h, I would #define _PY_WRITE_RESTRICTED 4 with an appropriate comment. (Note the leading underscore.)
  • The configure*, Python.h and HAVE_STDDEF_H stuff shouldn't change here. structmember.h should include stddef.h for backward compatibility, but the other stuff can be left to other PRs/issues, if necessary.
  • This needs an entry in What's New.

@MatzeB
Copy link
Contributor Author

MatzeB commented Oct 11, 2022

Hey, I am currently not working with python so I don't know when I would find the time to push this further. If you or someone else wants to take over, by all means!

@encukou
Copy link
Member

encukou commented Nov 2, 2022

Taking over in #99014

@encukou encukou closed this Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants