Skip to content

Conversation

@Yashp002
Copy link

@Yashp002 Yashp002 commented Nov 20, 2025

This PR adds C API documentation for six previously undocumented type objects:

In Doc/c-api/descriptor.rst:

  • PyClassMethodDescr_Type - type for class method descriptors
  • PyGetSetDescr_Type - type for get/set descriptors
  • PyMemberDescr_Type - type for member descriptors
  • PyMethodDescr_Type - type for method descriptors
  • PyWrapperDescr_Type - type for wrapper descriptors

In Doc/c-api/dict.rst:

  • PyDictProxy_Type - type for mapping proxy objects

Each 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/

@ZeroIntensity ZeroIntensity self-requested a review November 21, 2025 12:12
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``
Copy link
Member

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.

Comment on lines +39 to +40
methods on a type, and correspond to ``method_descriptor`` objects in the
Python layer.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

Comment on lines +51 to +52
via wrapper structures, and appear in Python as ``wrapper_descriptor``
objects.
Copy link
Member

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.

Comment on lines +91 to +96
.. 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.
Copy link
Member

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.

Comment on lines +52 to +53
underlying dictionary are reflected in the proxy, but the proxy itself
does not support mutation operations.
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants