| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4a1c58d commit 1438b77
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1245,6 +1245,17 @@ and :c:type:`PyType_Type` effectively act as defaults.) | |||
| 1245 | 1245 | **Inheritance:** | |
| 1246 | 1246 | ||
| 1247 | 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. | ||
| 1248 | 1259 | ||
| 1249 | 1260 | .. versionadded:: 3.10 | |
| 1250 | 1261 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments