Skip to content

GH-95245: Document use of MANAGED flags instead of offsets. - #96044

Merged
markshannon merged 5 commits into
python:mainfrom
faster-cpython:document-preheader-further
Aug 30, 2022
Merged

markshannon merged 5 commits into
python:mainfrom
faster-cpython:document-preheader-further

Conversation

@markshannon

@markshannon markshannon commented Aug 17, 2022 •

Copy link
Copy Markdown
Member

@markshannon markshannon added docs Documentation in the Doc dir skip news labels Aug 17, 2022
@markshannon
markshannon requested a review from mdboom August 17, 2022 16:10
Comment thread Doc/c-api/structures.rst

The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and
:c:member:`~PyTypeObject.tp_weaklistoffset` are still supported, but extensions are
strongly encouraged to use ``Py_TPFLAGS_MANAGED_DICT`` and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Py_TPFLAGS_MANAGED_DICT and Py_TPFLAGS_MANAGED_WEAKREF link to their definition in typeobj.rst below?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:c:member:~PyTypeObject.tp_dictoffset` converts to a link to
https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_dictoffset
I don't think I can link into the table.

Comment thread Doc/c-api/typeobj.rst
| | | __ge__ | | | | |
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
| :c:member:`~PyTypeObject.tp_weaklistoffset` | :c:type:`Py_ssize_t` | | | X | | ? |
| (:c:member:`~PyTypeObject.tp_weaklistoffset`) | :c:type:`Py_ssize_t` | | | X | | ? |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentheses indicate deprecation? Should we maybe say "(Deprecated in Python 3.12)" instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs are always relevant to the current version, so it is implicit that this applies to 3.12.
This isn't a formal deprecation, more of a hint not to use these fields.

Comment thread Doc/c-api/typeobj.rst
| | | __delete__ | | | | |
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
| :c:member:`~PyTypeObject.tp_dictoffset` | :c:type:`Py_ssize_t` | | | X | | ? |
| (:c:member:`~PyTypeObject.tp_dictoffset`) | :c:type:`Py_ssize_t` | | | X | | ? |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above regarding deprecation.

Comment thread Doc/c-api/typeobj.rst Outdated
Comment thread Doc/extending/newtypes.rst Outdated
@markshannon
markshannon merged commit 0f733ff into python:main Aug 30, 2022
@markshannon
markshannon deleted the document-preheader-further branch September 26, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants