]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-66646: Explain __base__ attribute in the docs (GH-102554)
authorFurkan Onder <furkanonder@protonmail.com>
Mon, 20 Oct 2025 12:15:30 +0000 (21:15 +0900)
committerGitHub <noreply@github.com>
Mon, 20 Oct 2025 12:15:30 +0000 (14:15 +0200)
Co-authored-by: Éric <merwok@netwok.org>
Doc/reference/datamodel.rst

index 29f82fc12da1cc4bfdd4802436cd5ba3cf65e7b8..28ef5825159cb2da108f9b0aa86def3cb6f74cd4 100644 (file)
@@ -1185,6 +1185,7 @@ Special attributes
    single: __module__ (class attribute)
    single: __dict__ (class attribute)
    single: __bases__ (class attribute)
+   single: __base__ (class attribute)
    single: __doc__ (class attribute)
    single: __annotations__ (class attribute)
    single: __annotate__ (class attribute)
@@ -1219,6 +1220,13 @@ Special attributes
        In most cases, for a class defined as ``class X(A, B, C)``,
        ``X.__bases__`` will be exactly equal to ``(A, B, C)``.
 
+   * - .. attribute:: type.__base__
+     - .. impl-detail::
+
+          The single base class in the inheritance chain that is responsible
+          for the memory layout of instances. This attribute corresponds to
+          :c:member:`~PyTypeObject.tp_base` at the C level.
+
    * - .. attribute:: type.__doc__
      - The class's documentation string, or ``None`` if undefined.
        Not inherited by subclasses.