-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141004: Document descriptor and dict proxy type objects #141803
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
| The type object for member descriptor objects created from | ||
| :c:type:`PyMemberDef` structures. These descriptors expose fields of a | ||
| C struct as attributes on a type, and correspond to ``member_descriptor`` |
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.
Please link to :class:`types.MemberDescriptorType` instead.
| methods on a type, and correspond to ``method_descriptor`` objects in the | ||
| Python layer. |
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.
Ditto.
| via wrapper structures, and appear in Python as ``wrapper_descriptor`` | ||
| objects. |
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.
Use :class:`types.WrapperDescriptorType` here.
| .. c:var:: PyTypeObject PyGetSetDescr_Type | ||
| The type object for get/set descriptor objects created from | ||
| :c:type:`PyGetSetDef` structures. These descriptors implement attributes | ||
| whose value is computed by C getter and setter functions, and are used | ||
| for many built-in type attributes. |
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 one is in the wrong section, so please move it. The "Built-in descriptors" section is for objects like classmethod and super.
| underlying dictionary are reflected in the proxy, but the proxy itself | ||
| does not support mutation operations. |
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.
Could you point to types.MappingProxyType somewhere?
This PR adds C API documentation for six previously undocumented type objects:
In
Doc/c-api/descriptor.rst:PyClassMethodDescr_Type- type for class method descriptorsPyGetSetDescr_Type- type for get/set descriptorsPyMemberDescr_Type- type for member descriptorsPyMethodDescr_Type- type for method descriptorsPyWrapperDescr_Type- type for wrapper descriptorsIn
Doc/c-api/dict.rst:PyDictProxy_Type- type for mapping proxy objectsEach entry follows the existing documentation style and includes a brief description of the type's purpose and its relationship to the Python layer.
Contributes to #141004.
📚 Documentation preview 📚: https://cpython-previews--141803.org.readthedocs.build/