From 35763a54156748983585097a534e0ba2022a7f26 Mon Sep 17 00:00:00 2001 From: Furkan Onder Date: Mon, 20 Oct 2025 21:15:30 +0900 Subject: [PATCH] gh-66646: Explain __base__ attribute in the docs (GH-102554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit faa169afa0dad9586b294ea9ab6e5e17c5712861) Co-authored-by: Furkan Onder Co-authored-by: Éric --- Doc/reference/datamodel.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 9e8e9324fb4668..7c4b84680b6025 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1158,6 +1158,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: __type_params__ (class attribute) @@ -1191,6 +1192,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.