Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-105578: DeprecateAnyStr in the docs#107116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletionsDoc/library/typing.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -864,6 +864,16 @@ using ``[]``.
def greet_proper(cond: bool) -> str | bytes:
return "hi there!" if cond else b"greetings!"

.. deprecated-removed:: 3.13 3.18
Deprecated in favor of the new :ref:`type parameter syntax <type-params>`.
Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See
:pep:`695` for more details.

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.

.. data:: LiteralString

Special type that includes only literal strings.
Expand DownExpand Up@@ -3700,3 +3710,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`
6 changes: 6 additions & 0 deletionsDoc/whatsnew/3.13.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -196,6 +196,12 @@ 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. Use
the new :ref:`type parameter syntax <type-params>` instead.
(Contributed by Michael The in :gh:`107116`.)

* :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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Deprecate :class:`typing.AnyStr` in favor of the new Type Parameter syntax.
See PEP 695.

[8]ページ先頭

©2009-2025 Movatter.jp