]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-65961: Document the deprecation of `__package__` and `__cached__` (GH-124377)
authorBrett Cannon <brett@python.org>
Mon, 23 Sep 2024 21:14:33 +0000 (14:14 -0700)
committerGitHub <noreply@github.com>
Mon, 23 Sep 2024 21:14:33 +0000 (14:14 -0700)
The code changes for warning related to `__package__` landed in Python 3.12. `__cached__` doesn't have any changes as it isn't used but only set by the import system.

Doc/deprecations/pending-removal-in-3.14.rst
Doc/deprecations/pending-removal-in-3.15.rst
Doc/library/importlib.rst
Doc/reference/import.rst
Misc/NEWS.d/next/Core_and_Builtins/2024-09-23-13-25-27.gh-issue-65961.LDqXV2.rst [new file with mode: 0644]

index 6c831ae366ced53f1a5f8f41c4a7fec155d06296..452d6643e1d146a904ece2274995a8ae23a9c999 100644 (file)
@@ -47,9 +47,6 @@ Pending Removal in Python 3.14
 * :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
   (Contributed by Alan Williams in :gh:`72346`.)
 
-* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
-  taken into consideration by the import system (:gh:`97879`).
-
 * :mod:`importlib.abc` deprecated classes:
 
   * :class:`!importlib.abc.ResourceReader`
index f7145a85bd2994d9c178030b61e72919f5bc8b0e..b921b4f97d524e66169a52c5b76b48d99aa2f9c1 100644 (file)
@@ -17,6 +17,9 @@ Pending Removal in Python 3.15
   * The :option:`!--cgi` flag to the :program:`python -m http.server`
     command-line interface has been deprecated since Python 3.13.
 
+* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
+  taken into consideration by the import system (:gh:`97879`).
+
 * :class:`locale`:
 
   * The :func:`~locale.getdefaultlocale` function
index d0a3d9d578e0cd2d0ea9cc69e75a8d27d5408aa2..e4cef1f3e3b7c01c4e1a6c5b1749621bfc512b8f 100644 (file)
@@ -1237,8 +1237,8 @@ find and load modules.
    .. attribute:: has_location
 
    ``True`` if the spec's :attr:`origin` refers to a loadable location,
-    ``False`` otherwise.  This value impacts how :attr:`origin` is interpreted
-    and how the module's :attr:`__file__` is populated.
+   ``False`` otherwise.  This value impacts how :attr:`origin` is interpreted
+   and how the module's :attr:`__file__` is populated.
 
 
 .. class:: AppleFrameworkLoader(name, path)
index 7de995b12702eca118f4f82f7815205c7df38574..19b8aa05072c733ff18e8e62caea7500355df744 100644 (file)
@@ -596,6 +596,10 @@ listed below.
       Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning`
       when falling back to ``__package__``.
 
+   .. deprecated-removed:: 3.13 3.15
+      ``__package__`` will cease to be set or taken into consideration
+      by the import system or standard library.
+
 
 .. attribute:: __spec__
 
@@ -653,6 +657,10 @@ listed below.
    It is **strongly** recommended that you rely on :attr:`__spec__`
    instead of ``__cached__``.
 
+   .. deprecated-removed:: 3.13 3.15
+      ``__cached__`` will cease to be set or taken into consideration
+      by the import system or standard library.
+
 .. _package-path-rules:
 
 module.__path__
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-09-23-13-25-27.gh-issue-65961.LDqXV2.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-23-13-25-27.gh-issue-65961.LDqXV2.rst
new file mode 100644 (file)
index 0000000..d380027
--- /dev/null
@@ -0,0 +1 @@
+Deprecate the setting and using ``__package__`` and ``__cached__``.