@@ -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
@@ -168,13 +177,6 @@ The following functions and structs are used to create
168
177
The associated module is not inherited by subclasses; it must be specified
169
178
for each class individually.
170
179
171
- If some of the bases in *bases * implements the GC protocol and the type being
172
- created does not include the :const: `Py_TPFLAGS_HAVE_GC ` in the flags included in
173
- *spec *, then the GC protocol will be automatically implemented from its parents. On
174
- the contrary, if the type being created does include :const: `Py_TPFLAGS_HAVE_GC ` in
175
- its flags then it *must * implement the GC protocol itself by at least including a slot
176
- for :c:member: `~PyTypeObject.tp_traverse ` in *spec *.
177
-
178
180
This function calls :c:func: `PyType_Ready ` on the new type.
179
181
180
182
.. versionadded :: 3.9
0 commit comments