-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-132331: Add tp_versions_used
to PyTypeObject
docs
#132335
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: sobolevn <[email protected]>
@@ -2229,6 +2231,17 @@ and :c:data:`PyType_Type` effectively act as defaults.) | |||
.. versionadded:: 3.12 | |||
|
|||
|
|||
.. c:member:: uint16_t PyTypeObject.tp_versions_used | |||
|
|||
Internal. Do not use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we document something, just to tell people not to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is exposed to the user who may use local PyTypeObject instances that are statically initialized (the LinuxCNC project implements that use case several places). If you do not initialize this field, then you get a warning missing initializer for member '_typeobject::tp_versions_used'
.
Therefore, it should be documented (and it needs to be set to zero when statically initialized).
Fixes #132331. Add
tp_versions_used
to the tp slots section, as well as a description of the field itself. I've read through #113462 and its corresponding PR to understand how this field came about, but please let me know if there are any inaccuracies, thanks!tp_versions_used
was added toPyTypeObject
but is not documented #132331📚 Documentation preview 📚: https://cpython-previews--132335.org.readthedocs.build/