We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a1c58d commit 1438b77Copy full SHA for 1438b77
Doc/c-api/typeobj.rst
@@ -1245,6 +1245,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
1245
**Inheritance:**
1246
1247
This flag is not inherited.
1248
+ However, subclasses will not be instantiable unless they provide a
1249
+ non-NULL :c:member:`~PyTypeObject.tp_new` (which is only possible
1250
+ via the C API).
1251
+
1252
+ .. note::
1253
1254
+ To disallow instantiating a class directly but allow instantiating
1255
+ its subclasses (e.g. for an :term:`abstract base class`),
1256
+ do not use this flag.
1257
+ Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for
1258
+ subclasses.
1259
1260
.. versionadded:: 3.10
1261
0 commit comments