@@ -97,6 +97,15 @@ Type Objects
97
97
from a type's base class. Return ``0 `` on success, or return ``-1 `` and sets an
98
98
exception on error.
99
99
100
+ .. note ::
101
+ If some of the base classes implements the GC protocol and the provided
102
+ type does not include the :const: `Py_TPFLAGS_HAVE_GC ` in its flags, then
103
+ the GC protocol will be automatically implemented from its parents. On
104
+ the contrary, if the type being created does include
105
+ :const: `Py_TPFLAGS_HAVE_GC ` in its flags then it **must ** implement the
106
+ GC protocol itself by at least implementing the
107
+ :c:member: `~PyTypeObject.tp_traverse ` handle.
108
+
100
109
.. c :function :: void * PyType_GetSlot (PyTypeObject *type, int slot)
101
110
102
111
Return the function pointer stored in the given slot. If the
@@ -169,13 +178,6 @@ The following functions and structs are used to create
169
178
The associated module is not inherited by subclasses; it must be specified
170
179
for each class individually.
171
180
172
- If some of the bases in *bases * implements the GC protocol and the type being
173
- created does not include the :const: `Py_TPFLAGS_HAVE_GC ` in the flags included in
174
- *spec *, then the GC protocol will be automatically implemented from its parents. On
175
- the contrary, if the type being created does include :const: `Py_TPFLAGS_HAVE_GC ` in
176
- its flags then it *must * implement the GC protocol itself by at least including a slot
177
- for :c:member: `~PyTypeObject.tp_traverse ` in *spec *.
178
-
179
181
This function calls :c:func: `PyType_Ready ` on the new type.
180
182
181
183
.. versionadded :: 3.9
0 commit comments