FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.11] gh-96746: Docs: Clear up Py_TPFLAGS_DISALLOW_INSTANTIATION inheritance (GH-99002) by miss-islington · Pull Request #99212 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 11 additions & 0 deletions Doc/c-api/typeobj.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
**Inheritance:**

This flag is not inherited.
However, subclasses will not be instantiable unless they provide a
non-NULL :c:member:`~PyTypeObject.tp_new` (which is only possible
via the C API).

.. note::

To disallow instantiating a class directly but allow instantiating
its subclasses (e.g. for an :term:`abstract base class`),
do not use this flag.
Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for
subclasses.

.. versionadded:: 3.10

Expand Down

Back | FazBrowse Home | New Git URL