Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-141004: Document descriptor and dict proxy type objects
  • Loading branch information
Yashp002 committed Nov 20, 2025
commit 874fc1c136656b960817f1b89f60ff6ccee3c17b
38 changes: 38 additions & 0 deletions Doc/c-api/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,35 @@
.. c:function:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth)


.. c:var:: PyTypeObject PyMemberDescr_Type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes in Doc/c-api/ are not related to this pr, please revert.


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``
objects in the Python layer.


.. c:function:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth)


.. c:var:: PyTypeObject PyMethodDescr_Type

Check warning on line 35 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Error in declarator or parameters

Check warning on line 35 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 11]

Check warning on line 35 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected identifier in nested name. [error at 0]

Check warning on line 35 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 9]
The type object for method descriptor objects created from
:c:type:`PyMethodDef` structures. These descriptors expose C functions as
methods on a type, and correspond to ``method_descriptor`` objects in the
Python layer.


.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped)


.. c:var:: PyTypeObject PyWrapperDescr_Type

Check warning on line 45 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected identifier in nested name. [error at 8]

Check warning on line 45 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 12]

Check warning on line 45 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 16]

Check warning on line 45 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected identifier in nested name. [error at 0]

Check warning on line 45 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 9]
The type object for wrapper descriptor objects created by
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper
descriptors are used internally to expose special methods implemented
via wrapper structures, and appear in Python as ``wrapper_descriptor``
objects.


.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)


Expand Down Expand Up @@ -55,6 +78,21 @@
:class:`classmethod` in the Python layer.


.. c:var:: PyTypeObject PyClassMethodDescr_Type

The type object for C-level class method descriptor objects.
This is the type of the descriptors created for :func:`classmethod` defined in C
extension types, and is the same object as :class:`classmethod` in the
Python layer.


.. c:var:: PyTypeObject PyGetSetDescr_Type

Check warning on line 89 in Doc/c-api/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Invalid C declaration: Expected end of definition. [error at 9]
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.


.. c:function:: PyObject *PyClassMethod_New(PyObject *callable)

Create a new :class:`classmethod` object wrapping *callable*.
Expand Down
9 changes: 9 additions & 0 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ Dictionary Objects
prevent modification of the dictionary for non-dynamic class types.


.. c:var:: PyTypeObject PyDictProxy_Type
The type object for mapping proxy objects created by
:c:func:`PyDictProxy_New` and for the read-only ``__dict__`` attribute
of many built-in types. A :c:type:`PyDictProxy_Type` instance provides a
dynamic, read-only view of an underlying dictionary: changes to the
underlying dictionary are reflected in the proxy, but the proxy itself
does not support mutation operations.


.. c:function:: void PyDict_Clear(PyObject *p)

Empty an existing dictionary of all key-value pairs.
Expand Down
Loading