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

Commita22ff8e

Browse files
authored
gh-105578: Document thatAnyStr is deprecated in py313 (#107116)
It will not be removed until Python 3.18.
1 parentf877b32 commita22ff8e

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

‎Doc/library/typing.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,16 @@ using ``[]``.
864864
def greet_proper(cond: bool) -> str | bytes:
865865
return "hi there!" if cond else b"greetings!"
866866

867+
..deprecated-removed::3.13 3.18
868+
Deprecated in favor of the new:ref:`type parameter syntax<type-params>`.
869+
Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See
870+
:pep:`695` for more details.
871+
872+
In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and
873+
deprecation warnings will be emitted at runtime when it is accessed or
874+
imported from ``typing``. ``AnyStr`` will be removed from ``typing``
875+
in Python 3.18.
876+
867877
..data::LiteralString
868878

869879
Special type that includes only literal strings.
@@ -3700,3 +3710,7 @@ convenience. This is subject to change, and not all deprecations are listed.
37003710
- 3.13
37013711
- 3.15
37023712
-:gh:`106309`
3713+
* -:data:`typing.AnyStr`
3714+
- 3.13
3715+
- 3.18
3716+
-:gh:`105578`

‎Doc/whatsnew/3.13.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ Deprecated
196196
has yet to be supported by any major type checkers.
197197
(Contributed by Alex Waygood in:gh:`106309`.)
198198

199+
*:data:`typing.AnyStr` is deprecated. In Python 3.16, it will be removed from
200+
``typing.__all__``, and a:exc:`DeprecationWarning` will be emitted when it
201+
is imported or accessed. It will be removed entirely in Python 3.18. Use
202+
the new:ref:`type parameter syntax<type-params>` instead.
203+
(Contributed by Michael The in:gh:`107116`.)
204+
199205
*:mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()``
200206
methods of the:class:`wave.Wave_read` and:class:`wave.Wave_write` classes.
201207
They will be removed in Python 3.15.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deprecate:class:`typing.AnyStr` in favor of the new Type Parameter syntax.
2+
See PEP 695.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp