Skip to content

Commit 873b53d

Browse files
AlexWaygoodCAM-Gerlach
authored andcommitted
pythongh-103373: __mro_entries__ docs: improve cross references (python#103398)
Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent a6efe6b commit 873b53d

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
@@ -2089,16 +2089,21 @@ Resolving MRO entries
20892089
.. method:: object.__mro_entries__(self, bases)
20902090

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

20992100
.. seealso::
21002101

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

21032108

21042109
Determining the appropriate metaclass

0 commit comments

Comments
 (0)