Skip to content

Commit 07a2851

Browse files
miss-islingtonAlexWaygoodCAM-Gerlach
authored
gh-103373: __mro_entries__ docs: improve cross references (GH-103398)
(cherry picked from commit e071f00) Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 254494c commit 07a2851

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Doc/library/types.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ Dynamic Type Creation
7575

7676
This function looks for items in *bases* that are not instances of
7777
:class:`type`, and returns a tuple where each such object that has
78-
an ``__mro_entries__`` method is replaced with an unpacked result of
78+
an :meth:`~object.__mro_entries__` method is replaced with an unpacked result of
7979
calling this method. If a *bases* item is an instance of :class:`type`,
80-
or it doesn't have an ``__mro_entries__`` method, then it is included in
80+
or it doesn't have an :meth:`!__mro_entries__` method, then it is included in
8181
the return tuple unchanged.
8282

8383
.. versionadded:: 3.7

Doc/reference/datamodel.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,16 +2088,21 @@ Resolving MRO entries
20882088
.. method:: object.__mro_entries__(self, bases)
20892089

20902090
If a base that appears in a class definition is not an instance of
2091-
:class:`type`, then an ``__mro_entries__`` method is searched on the base.
2092-
If an ``__mro_entries__`` method is found, the base is substituted with the
2093-
result of a call to ``__mro_entries__`` when creating the class.
2094-
The method is called with the original bases tuple, and must return a tuple
2091+
:class:`type`, then an :meth:`!__mro_entries__` method is searched on the base.
2092+
If an :meth:`!__mro_entries__` method is found, the base is substituted with the
2093+
result of a call to :meth:`!__mro_entries__` when creating the class.
2094+
The method is called with the original bases tuple
2095+
passed to the *bases* parameter, and must return a tuple
20952096
of classes that will be used instead of the base. The returned tuple may be
20962097
empty: in these cases, the original base is ignored.
20972098

20982099
.. seealso::
20992100

2100-
:pep:`560` - Core support for typing module and generic types
2101+
:func:`types.resolve_bases`
2102+
Dynamically resolve bases that are not instances of :class:`type`.
2103+
2104+
:pep:`560`
2105+
Core support for typing module and generic types.
21012106

21022107

21032108
Determining the appropriate metaclass

0 commit comments

Comments
 (0)