Skip to content

Commit 7dead6a

Browse files
authored
[3.11] gh-106745: typing docs: Clarify that removal of PEP-585 aliases is not currently planned (#106748) (#106773)
1 parent b132b77 commit 7dead6a

File tree

1 file changed

+37
-21
lines changed

1 file changed

+37
-21
lines changed

Doc/library/typing.rst

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,6 +2745,7 @@ Constant
27452745
.. versionadded:: 3.5.2
27462746

27472747
.. _generic-concrete-collections:
2748+
.. _deprecated-typing-aliases:
27482749

27492750
Deprecated aliases
27502751
------------------
@@ -2753,16 +2754,21 @@ This module defines several deprecated aliases to pre-existing
27532754
standard library classes. These were originally included in the typing
27542755
module in order to support parameterizing these generic classes using ``[]``.
27552756
However, the aliases became redundant in Python 3.9 when the
2756-
corresponding pre-existing classes were enhanced to support ``[]``.
2757+
corresponding pre-existing classes were enhanced to support ``[]`` (see
2758+
:pep:`585`).
27572759

2758-
The redundant types are deprecated as of Python 3.9 but no
2759-
deprecation warnings are issued by the interpreter.
2760-
It is expected that type checkers will flag the deprecated types
2761-
when the checked program targets Python 3.9 or newer.
2760+
The redundant types are deprecated as of Python 3.9. However, while the aliases
2761+
may be removed at some point, removal of these aliases is not currently
2762+
planned. As such, no deprecation warnings are currently issued by the
2763+
interpreter for these aliases.
27622764

2763-
The deprecated types will be removed from the :mod:`typing` module
2764-
no sooner than the first Python version released 5 years after the release of Python 3.9.0.
2765-
See details in :pep:`585`—*Type Hinting Generics In Standard Collections*.
2765+
If at some point it is decided to remove these deprecated aliases, a
2766+
deprecation warning will be issued by the interpreter for at least two releases
2767+
prior to removal. The aliases are guaranteed to remain in the typing module
2768+
without deprecation warnings until at least Python 3.14.
2769+
2770+
Type checkers are encouraged to flag uses of the deprecated types if the
2771+
program they are checking targets a minimum Python version of 3.9 or newer.
27662772

27672773
.. _corresponding-to-built-in-types:
27682774

@@ -3295,16 +3301,26 @@ Certain features in ``typing`` are deprecated and may be removed in a future
32953301
version of Python. The following table summarizes major deprecations for your
32963302
convenience. This is subject to change, and not all deprecations are listed.
32973303

3298-
+----------------------------------+---------------+-------------------+----------------+
3299-
| Feature | Deprecated in | Projected removal | PEP/issue |
3300-
+==================================+===============+===================+================+
3301-
| ``typing.io`` and ``typing.re`` | 3.8 | 3.13 | :issue:`38291` |
3302-
| submodules | | | |
3303-
+----------------------------------+---------------+-------------------+----------------+
3304-
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
3305-
| collections | | | |
3306-
+----------------------------------+---------------+-------------------+----------------+
3307-
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
3308-
+----------------------------------+---------------+-------------------+----------------+
3309-
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
3310-
+----------------------------------+---------------+-------------------+----------------+
3304+
.. list-table::
3305+
:header-rows: 1
3306+
3307+
* - Feature
3308+
- Deprecated in
3309+
- Projected removal
3310+
- PEP/issue
3311+
* - ``typing.io`` and ``typing.re`` submodules
3312+
- 3.8
3313+
- 3.13
3314+
- :issue:`38291`
3315+
* - ``typing`` versions of standard collections
3316+
- 3.9
3317+
- Undecided (see :ref:`deprecated-typing-aliases` for more information)
3318+
- :pep:`585`
3319+
* - :class:`typing.ByteString`
3320+
- 3.9
3321+
- 3.14
3322+
- :gh:`91896`
3323+
* - :data:`typing.Text`
3324+
- 3.11
3325+
- Undecided
3326+
- :gh:`92332`

0 commit comments

Comments
 (0)