bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index c595242..b5ac21d 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -675,6 +675,13 @@
:meth:`~importlib.abc.Loader.module_repr` method, if defined, before
trying either approach described above. However, the method is deprecated.
+.. versionchanged:: 3.10
+
+ Calling :meth:`~importlib.abc.Loader.module_repr` now occurs after trying to
+ use a module's ``__spec__`` attribute but before falling back on
+ ``__file__``. Use of :meth:`~importlib.abc.Loader.module_repr` is slated to
+ stop in Python 3.12.
+
.. _pyc-invalidation:
Cached bytecode invalidation
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 30bc35d..1c4e5c4 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -1010,6 +1010,12 @@
for Python 3.12.
(Contributed by Brett Cannon in :issue:`42137`.)
+* :meth:`importlib.abc.Loader.module_repr`,
+ :meth:`importlib.machinery.FrozenLoader.module_repr`, and
+ :meth:`importlib.machinery.BuiltinLoader.module_repr` are deprecated and
+ slated for removal in Python 3.12.
+ (Contributed by Brett Cannon in :issue:`42136`.)
+
* ``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python
3.3, when it was made an alias to :class:`str`. It is now deprecated,
scheduled for removal in Python 3.12.