diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index b48cf951137e51..7a3e5357e0c2ca 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/deprecations/pending-removal-in-3.15.rst b/Doc/deprecations/pending-removal-in-3.15.rst index 5c0e592f4caeda..82a83e068363a9 100644 --- a/Doc/deprecations/pending-removal-in-3.15.rst +++ b/Doc/deprecations/pending-removal-in-3.15.rst @@ -1,13 +1,6 @@ Pending removal in Python 3.15 ------------------------------ -* The import system: - - * 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 - take into consideration by the import system or standard library. (:gh:`97879`) - * :mod:`ctypes`: * The undocumented :func:`!ctypes.SetPointerType` function diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst index d764a98c8419ed..9e1ec4691872f0 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 2a961a062780f4..fde3cef63bc6e9 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1099,14 +1099,9 @@ this approach. :ref:`import system ` 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 5a8ab88a30fcf5..9a1efd811eb2bc 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 ` 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