Skip to content

Commit cf98f39

Browse files
miss-islingtonbrettcannonwarsaw
authored
[3.13] GH-65961: Document the deprecation of __package__ and __cached__ (GH-124377) (#124380)
* GH-65961: Document the deprecation of `__package__` and `__cached__` (GH-124377) 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. (cherry picked from commit 67201ad) --------- Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Barry Warsaw <barry@python.org>
1 parent 862ec8b commit cf98f39

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

Doc/deprecations/pending-removal-in-3.14.rst

-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ Pending Removal in Python 3.14
4747
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
4848
(Contributed by Alan Williams in :gh:`72346`.)
4949

50-
* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
51-
taken into consideration by the import system (:gh:`97879`).
52-
5350
* :mod:`importlib.abc` deprecated classes:
5451

5552
* :class:`!importlib.abc.ResourceReader`

Doc/deprecations/pending-removal-in-3.15.rst

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Pending Removal in Python 3.15
1717
* The :option:`!--cgi` flag to the :program:`python -m http.server`
1818
command-line interface has been deprecated since Python 3.13.
1919

20+
* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
21+
taken into consideration by the import system (:gh:`97879`).
22+
2023
* :class:`locale`:
2124

2225
* The :func:`~locale.getdefaultlocale` function

Doc/reference/import.rst

+8
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ listed below.
596596
Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning`
597597
when falling back to ``__package__``.
598598

599+
.. deprecated-removed:: 3.13 3.15
600+
``__package__`` will cease to be set or taken into consideration
601+
by the import system or standard library.
602+
599603

600604
.. attribute:: __spec__
601605

@@ -653,6 +657,10 @@ listed below.
653657
It is **strongly** recommended that you rely on :attr:`__spec__`
654658
instead of ``__cached__``.
655659

660+
.. deprecated-removed:: 3.13 3.15
661+
``__cached__`` will cease to be set or taken into consideration
662+
by the import system or standard library.
663+
656664
.. _package-path-rules:
657665

658666
module.__path__
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document the deprecation of setting and using ``__package__`` and ``__cached__``.

0 commit comments

Comments
 (0)