https://github.com/python/cpython/commit/228b1bf745836e5f2097ee273d2c3f731fd1c3d5
commit: 228b1bf745836e5f2097ee273d2c3f731fd1c3d5
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-08-20T17:02:56+02:00
summary:

gh-65961: Document __cached__ removal in What's New & clarify references to it 
(GH-156053)

- Mention the change in What's New
- Clarify references to ``__cached__`` now that the term it doesn't link to its 
docs.
- Move the ``.. versionchanged`` from ``__file__`` docs to the top level.

files:
M Doc/c-api/import.rst
M Doc/library/runpy.rst
M Doc/reference/datamodel.rst
M Doc/whatsnew/3.15.rst

diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index b48cf951137e511..7a3e5357e0c2cac 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -146,7 +146,7 @@ Importing Modules
       alternatives.
 
    .. versionchanged:: 3.15
-      ``__cached__`` is no longer set.
+      The ``__cached__`` attribute is no longer set.
 
 
 .. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject 
*co, const char *pathname)
@@ -170,7 +170,7 @@ Importing Modules
       :class:`~importlib.machinery.ModuleSpec` for alternatives.
 
    .. versionchanged:: 3.15
-      ``__cached__`` no longer set.
+      The ``__cached__`` attribute no longer set.
 
 
 .. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char 
*name, PyObject *co, const char *pathname, const char *cpathname)
diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst
index d764a98c8419ed3..9e1ec4691872f05 100644
--- a/Doc/library/runpy.rst
+++ b/Doc/library/runpy.rst
@@ -97,7 +97,7 @@ The :mod:`!runpy` module provides two functions:
       :class:`~importlib.machinery.ModuleSpec` for alternatives.
 
    .. versionchanged:: 3.15
-      ``__cached__`` is no longer set.
+      The global variable ``__cached__`` is no longer set.
 
 .. function:: run_path(path_name, init_globals=None, run_name=None)
 
@@ -175,7 +175,7 @@ The :mod:`!runpy` module provides two functions:
       ``__package__`` are deprecated.
 
    .. versionchanged:: 3.15
-      ``__cached__`` is no longer set.
+      The global variable ``__cached__`` is no longer set.
 
 .. seealso::
 
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 2a961a062780f46..fde3cef63bc6e90 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1099,14 +1099,9 @@ this approach.
    :ref:`import system <importsystem>` may opt to leave it unset if it
    has no semantic meaning (for example, a module loaded from a database).
 
-   .. deprecated-removed:: 3.13 3.15
-      Setting ``__cached__`` on a module while failing to set
-      :attr:`!__spec__.cached` is deprecated. In Python 3.15,
-      ``__cached__`` will cease to be set or taken into consideration by
-      the import system or standard library.
-
-   .. versionchanged:: 3.15
-      ``__cached__`` is no longer set.
+.. versionchanged:: 3.15
+   The ``__cached__`` attribute is no longer set on modules or taken into
+   consideration by the import system or standard library.
 
 Other writable attributes on module objects
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst
index 5a8ab88a30fcf58..9a1efd811eb2bc7 100644
--- a/Doc/whatsnew/3.15.rst
+++ b/Doc/whatsnew/3.15.rst
@@ -880,6 +880,14 @@ Other language changes
   other, as regular dynamic extensions do.
   (Contributed by Stefano Rivera in :gh:`122931`.)
 
+* The ``__cached__`` attribute on modules, which was deprecated since version
+  3.13, is no longer set or taken into consideration by the import system or
+  standard library.
+  Use :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` instead.
+  (Contributed by Brett Cannon in :gh:`97879`)
+
+  Note that the :attr:`~module.__loader__` and :attr:`~module.__package__`
+  attributes are also deprecated and scheduled for removal.
 
 
 Default interactive shell

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to