[Python-checkins] gh-103373: `__mro_entries__` docs: improve cross references (GH-103398)
miss-islington
webhook-mailer at python.org
Tue Apr 11 06:34:54 EDT 2023
https://github.com/python/cpython/commit/07a2851edbf664f2dc87a888fc57315ab53f4b56
commit: 07a2851edbf664f2dc87a888fc57315ab53f4b56
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-04-11T03:34:46-07:00
summary:
gh-103373: `__mro_entries__` docs: improve cross references (GH-103398)
(cherry picked from commit e071f00aaefae9eccf787d5c50396c26c8616483)
Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach at Gerlach.CAM>
files:
M Doc/library/types.rst
M Doc/reference/datamodel.rst
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 3416871c0c1f..daca0ea4318b 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -75,9 +75,9 @@ Dynamic Type Creation
This function looks for items in *bases* that are not instances of
:class:`type`, and returns a tuple where each such object that has
- an ``__mro_entries__`` method is replaced with an unpacked result of
+ an :meth:`~object.__mro_entries__` method is replaced with an unpacked result of
calling this method. If a *bases* item is an instance of :class:`type`,
- or it doesn't have an ``__mro_entries__`` method, then it is included in
+ or it doesn't have an :meth:`!__mro_entries__` method, then it is included in
the return tuple unchanged.
.. versionadded:: 3.7
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index b086be26999c..3f0c99cd09eb 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2088,16 +2088,21 @@ Resolving MRO entries
.. method:: object.__mro_entries__(self, bases)
If a base that appears in a class definition is not an instance of
- :class:`type`, then an ``__mro_entries__`` method is searched on the base.
- If an ``__mro_entries__`` method is found, the base is substituted with the
- result of a call to ``__mro_entries__`` when creating the class.
- The method is called with the original bases tuple, and must return a tuple
+ :class:`type`, then an :meth:`!__mro_entries__` method is searched on the base.
+ If an :meth:`!__mro_entries__` method is found, the base is substituted with the
+ result of a call to :meth:`!__mro_entries__` when creating the class.
+ The method is called with the original bases tuple
+ passed to the *bases* parameter, and must return a tuple
of classes that will be used instead of the base. The returned tuple may be
empty: in these cases, the original base is ignored.
.. seealso::
- :pep:`560` - Core support for typing module and generic types
+ :func:`types.resolve_bases`
+ Dynamically resolve bases that are not instances of :class:`type`.
+
+ :pep:`560`
+ Core support for typing module and generic types.
Determining the appropriate metaclass
More information about the Python-checkins
mailing list