Thanks to visit codestin.com
Credit goes to github.com

Skip to content
14 changes: 14 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,16 @@ using ``[]``.

.. data:: AnyStr

.. deprecated-removed:: 3.13 3.18
Deprecated in favor of the new type parameter syntax. Use
``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See
:pep:`695` for more details.
Comment thread
michael-the1 marked this conversation as resolved.
Outdated
Comment thread
michael-the1 marked this conversation as resolved.
Outdated

In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and
deprecation warnings will be emitted at runtime when it is accessed or
imported from ``typing``. ``AnyStr`` will be removed from ``typing``
in Python 3.18.

A :ref:`constrained type variable <typing-constrained-typevar>`.

Definition::
Expand Down Expand Up @@ -3688,3 +3698,7 @@ convenience. This is subject to change, and not all deprecations are listed.
- 3.13
- 3.15
- :gh:`106309`
* - :data:`typing.AnyStr`
- 3.13
- 3.18
- :gh:`105578`
10 changes: 10 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ Deprecated
has yet to be supported by any major type checkers.
(Contributed by Alex Waygood in :gh:`106309`.)

* :data:`typing.AnyStr` is deprecated. In Python 3.16, it will be removed from
``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted when it
is imported or accessed. It will be removed entirely in Python 3.18.
(Contributed by Michael The in :gh:`107116`.)
Comment thread
michael-the1 marked this conversation as resolved.

* :mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()``
methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes.
They will be removed in Python 3.15.
Expand Down Expand Up @@ -332,6 +337,11 @@ Pending Removal in Python 3.16
* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
use the ``'w'`` type instead (``Py_UCS4``).

Pending Removal in Python 3.18
------------------------------

* :class:`typing.AnyStr`: Use the new type parameter syntax instead. See :pep:`695`. (:gh:`105578`)
Comment thread
michael-the1 marked this conversation as resolved.
Outdated

Pending Removal in Future Versions
----------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate :class:`typing.AnyStr` in favor of the new Type Parameter syntax.
See PEP 695.