Skip to content

Commit 874fc1c

Browse files
committed
gh-141004: Document descriptor and dict proxy type objects
1 parent 85f3009 commit 874fc1c

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Doc/c-api/descriptor.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,35 @@ found in the dictionary of type objects.
2121
.. c:function:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth)
2222
2323
24+
.. c:var:: PyTypeObject PyMemberDescr_Type
25+
26+
The type object for member descriptor objects created from
27+
:c:type:`PyMemberDef` structures. These descriptors expose fields of a
28+
C struct as attributes on a type, and correspond to ``member_descriptor``
29+
objects in the Python layer.
30+
31+
2432
.. c:function:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth)
2533
2634
35+
.. c:var:: PyTypeObject PyMethodDescr_Type
36+
The type object for method descriptor objects created from
37+
:c:type:`PyMethodDef` structures. These descriptors expose C functions as
38+
methods on a type, and correspond to ``method_descriptor`` objects in the
39+
Python layer.
40+
41+
2742
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped)
2843
2944
45+
.. c:var:: PyTypeObject PyWrapperDescr_Type
46+
The type object for wrapper descriptor objects created by
47+
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper
48+
descriptors are used internally to expose special methods implemented
49+
via wrapper structures, and appear in Python as ``wrapper_descriptor``
50+
objects.
51+
52+
3053
.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
3154
3255
@@ -55,6 +78,21 @@ Built-in descriptors
5578
:class:`classmethod` in the Python layer.
5679
5780
81+
.. c:var:: PyTypeObject PyClassMethodDescr_Type
82+
83+
The type object for C-level class method descriptor objects.
84+
This is the type of the descriptors created for :func:`classmethod` defined in C
85+
extension types, and is the same object as :class:`classmethod` in the
86+
Python layer.
87+
88+
89+
.. c:var:: PyTypeObject PyGetSetDescr_Type
90+
The type object for get/set descriptor objects created from
91+
:c:type:`PyGetSetDef` structures. These descriptors implement attributes
92+
whose value is computed by C getter and setter functions, and are used
93+
for many built-in type attributes.
94+
95+
5896
.. c:function:: PyObject *PyClassMethod_New(PyObject *callable)
5997
6098
Create a new :class:`classmethod` object wrapping *callable*.

Doc/c-api/dict.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ Dictionary Objects
4343
prevent modification of the dictionary for non-dynamic class types.
4444
4545
46+
.. c:var:: PyTypeObject PyDictProxy_Type
47+
The type object for mapping proxy objects created by
48+
:c:func:`PyDictProxy_New` and for the read-only ``__dict__`` attribute
49+
of many built-in types. A :c:type:`PyDictProxy_Type` instance provides a
50+
dynamic, read-only view of an underlying dictionary: changes to the
51+
underlying dictionary are reflected in the proxy, but the proxy itself
52+
does not support mutation operations.
53+
54+
4655
.. c:function:: void PyDict_Clear(PyObject *p)
4756
4857
Empty an existing dictionary of all key-value pairs.

0 commit comments

Comments
 (0)