@@ -149,10 +149,16 @@ Quick Reference
149149 +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150150
151151.. [#slots ]
152- A slot name in parentheses indicates it is (effectively) deprecated.
153- Names in angle brackets should be treated as read-only.
154- Names in square brackets are for internal use only.
155- "<R>" (as a prefix) means the field is required (must be non-``NULL ``).
152+
153+ **() **: A slot name in parentheses indicates it is (effectively) deprecated.
154+
155+ **<> **: Names in angle brackets should be initially set to ``NULL `` and
156+ treated as read-only.
157+
158+ **[] **: Names in square brackets are for internal use only.
159+
160+ **<R> ** (as a prefix) means the field is required (must be non-``NULL ``).
161+
156162 .. [#cols ] Columns:
157163
158164 **"O" **: set on :c:type: `PyBaseObject_Type `
@@ -1213,6 +1219,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
12131219 **Inheritance: **
12141220
12151221 This flag is not inherited.
1222+ However, subclasses will not be instantiable unless they provide a
1223+ non-NULL :c:member: `~PyTypeObject.tp_new ` (which is only possible
1224+ via the C API).
1225+
1226+ .. note ::
1227+
1228+ To disallow instantiating a class directly but allow instantiating
1229+ its subclasses (e.g. for an :term: `abstract base class `),
1230+ do not use this flag.
1231+ Instead, make :c:member: `~PyTypeObject.tp_new ` only succeed for
1232+ subclasses.
12161233
12171234 .. versionadded :: 3.10
12181235
@@ -1892,8 +1909,19 @@ and :c:type:`PyType_Type` effectively act as defaults.)
18921909
18931910 Tuple of base types.
18941911
1895- This is set for types created by a class statement. It should be ``NULL `` for
1896- statically defined types.
1912+ This field should be set to ``NULL `` and treated as read-only.
1913+ Python will fill it in when the type is :c:func: `initialized <PyType_Ready> `.
1914+
1915+ For dynamically created classes, the ``Py_tp_bases ``
1916+ :c:type: `slot <PyType_Slot> ` can be used instead of the *bases * argument
1917+ of :c:func: `PyType_FromSpecWithBases `.
1918+ The argument form is preferred.
1919+
1920+ .. warning ::
1921+
1922+ Multiple inheritance does not work well for statically defined types.
1923+ If you set ``tp_bases `` to a tuple, Python will not raise an error,
1924+ but some slots will only be inherited from the first base.
18971925
18981926 **Inheritance: **
18991927
@@ -1905,6 +1933,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19051933 Tuple containing the expanded set of base types, starting with the type itself
19061934 and ending with :class: `object `, in Method Resolution Order.
19071935
1936+ This field should be set to ``NULL `` and treated as read-only.
1937+ Python will fill it in when the type is :c:func: `initialized <PyType_Ready> `.
19081938
19091939 **Inheritance: **
19101940
0 commit comments