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

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

.. data:: AnyStr

.. deprecated:: 3.13
Comment thread
michael-the1 marked this conversation as resolved.
Outdated
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

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

Definition::
Expand Down
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`.)

* :class:`typing.AnyStr` is deprecated in docs since Python 3.13. The intention
is to remove ``AnyStr`` from ``__all__`` and emit a :exc:`DeprecationWarning`
in Python 3.16, and to remove ``AnyStr`` entirely in Python 3.18.
Comment thread
michael-the1 marked this conversation as resolved.
Outdated
(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.