Skip to content

Commit e99b69c

Browse files
authored
[3.12] gh-106745: typing docs: Clarify that removal of PEP-585 aliases is not currently planned (#106748) (#106772)
1 parent 1fe8412 commit e99b69c

File tree

1 file changed

+45
-26
lines changed

1 file changed

+45
-26
lines changed

Doc/library/typing.rst

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,7 @@ Constant
30533053
.. versionadded:: 3.5.2
30543054

30553055
.. _generic-concrete-collections:
3056+
.. _deprecated-aliases:
30563057

30573058
Deprecated aliases
30583059
------------------
@@ -3061,16 +3062,21 @@ This module defines several deprecated aliases to pre-existing
30613062
standard library classes. These were originally included in the typing
30623063
module in order to support parameterizing these generic classes using ``[]``.
30633064
However, the aliases became redundant in Python 3.9 when the
3064-
corresponding pre-existing classes were enhanced to support ``[]``.
3065+
corresponding pre-existing classes were enhanced to support ``[]`` (see
3066+
:pep:`585`).
30653067

3066-
The redundant types are deprecated as of Python 3.9 but no
3067-
deprecation warnings are issued by the interpreter.
3068-
It is expected that type checkers will flag the deprecated types
3069-
when the checked program targets Python 3.9 or newer.
3068+
The redundant types are deprecated as of Python 3.9. However, while the aliases
3069+
may be removed at some point, removal of these aliases is not currently
3070+
planned. As such, no deprecation warnings are currently issued by the
3071+
interpreter for these aliases.
30703072

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

30753081
.. _corresponding-to-built-in-types:
30763082

@@ -3611,21 +3617,34 @@ Certain features in ``typing`` are deprecated and may be removed in a future
36113617
version of Python. The following table summarizes major deprecations for your
36123618
convenience. This is subject to change, and not all deprecations are listed.
36133619

3614-
+----------------------------------+---------------+-------------------+----------------+
3615-
| Feature | Deprecated in | Projected removal | PEP/issue |
3616-
+==================================+===============+===================+================+
3617-
| ``typing.io`` and ``typing.re`` | 3.8 | 3.13 | :issue:`38291` |
3618-
| submodules | | | |
3619-
+----------------------------------+---------------+-------------------+----------------+
3620-
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
3621-
| collections | | | |
3622-
+----------------------------------+---------------+-------------------+----------------+
3623-
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
3624-
+----------------------------------+---------------+-------------------+----------------+
3625-
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
3626-
+----------------------------------+---------------+-------------------+----------------+
3627-
| ``typing.Hashable`` and | 3.12 | Undecided | :gh:`94309` |
3628-
| ``typing.Sized`` | | | |
3629-
+----------------------------------+---------------+-------------------+----------------+
3630-
| ``typing.TypeAlias`` | 3.12 | Undecided | :pep:`695` |
3631-
+----------------------------------+---------------+-------------------+----------------+
3620+
.. list-table::
3621+
:header-rows: 1
3622+
3623+
* - Feature
3624+
- Deprecated in
3625+
- Projected removal
3626+
- PEP/issue
3627+
* - ``typing.io`` and ``typing.re`` submodules
3628+
- 3.8
3629+
- 3.13
3630+
- :issue:`38291`
3631+
* - ``typing`` versions of standard collections
3632+
- 3.9
3633+
- Undecided (see :ref:`deprecated-aliases` for more information)
3634+
- :pep:`585`
3635+
* - :class:`typing.ByteString`
3636+
- 3.9
3637+
- 3.14
3638+
- :gh:`91896`
3639+
* - :data:`typing.Text`
3640+
- 3.11
3641+
- Undecided
3642+
- :gh:`92332`
3643+
* - :class:`typing.Hashable` and :class:`typing.Sized`
3644+
- 3.12
3645+
- Undecided
3646+
- :gh:`94309`
3647+
* - :data:`typing.TypeAlias`
3648+
- 3.12
3649+
- Undecided
3650+
- :pep:`695`

0 commit comments

Comments
 (0)