Skip to content

Commit ded0b99

Browse files
committed
Here's what I meant :)
- Mention the publicly-unusable API from prose, with no-typesetting entries for search & index - Merge the duplicate description of what wrapperdescrs are; put it in the type docs. (The *type* might be useful for extensions.)
1 parent 0f76cbb commit ded0b99

1 file changed

Lines changed: 28 additions & 25 deletions

File tree

‎Doc/c-api/descriptor.rst‎

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ found in the dictionary of type objects.
7272
methods on a type, and correspond to :class:`types.MethodDescriptorType`
7373
objects in Python.
7474
75+
.. c:var:: PyTypeObject PyWrapperDescr_Type
76+
77+
The type object for wrapper descriptor objects created by
78+
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`.
79+
80+
Wrapper descriptors are used internally to expose special methods
81+
such as ``__repr__`` or ``__add__``, which are implemented by type slots.
82+
The type is exposed in Python as :class:`types.WrapperDescriptorType`.
83+
84+
85+
.. `wrapperbase` & `PyWrapperFlag_KEYWORDS` show up in search and index,
86+
and link here, but are only referenced in prose:
87+
88+
.. c:struct:: wrapperbase
89+
:no-typesetting:
90+
91+
.. c:macro:: PyWrapperFlag_KEYWORDS
92+
:no-typesetting:
93+
94+
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
95+
96+
Create a new wrapper descriptor of type :c:var:`PyWrapperDescr_Type`.
97+
98+
This function is meant for internal use only; it and
99+
related API (``struct wrapperbase`` and the ``PyWrapperFlag_KEYWORDS``
100+
flag) are exposed publicly for backwards compatibility reasons.
101+
102+
See :c:func:`PyCMethod_New` for wrapping a C function.
75103
76104
.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
77105
@@ -143,31 +171,6 @@ found in the dictionary of type objects.
143171
.. soft-deprecated:: 3.15
144172
145173
146-
.. c:struct:: wrapperbase
147-
:no-contents-entry:
148-
:no-index-entry:
149-
:no-typesetting:
150-
.. c:type:: PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped)
151-
:no-contents-entry:
152-
:no-index-entry:
153-
:no-typesetting:
154-
.. c:type:: PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds)
155-
:no-contents-entry:
156-
:no-index-entry:
157-
:no-typesetting:
158-
.. c:macro:: PyWrapperFlag_KEYWORDS
159-
:no-contents-entry:
160-
:no-index-entry:
161-
:no-typesetting:
162-
.. c:var:: PyTypeObject PyWrapperDescr_Type
163-
:no-contents-entry:
164-
:no-index-entry:
165-
:no-typesetting:
166-
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
167-
168-
For internal use only; do not use in extensions.
169-
170-
171174
Built-in descriptors
172175
^^^^^^^^^^^^^^^^^^^^
173176

0 commit comments

Comments
 (0)