summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorMichael The <michael-the1@users.noreply.github.com>2023-07-31 15:43:53 (GMT)
committerGitHub <noreply@github.com>2023-07-31 15:43:53 (GMT)
commita22ff8e11c114e0c4c54c57b9e7f7520db9d5163 (patch)
treebd080edc0bbf49423b0fd319551c16109de5ea33 /Doc/library
parentf877b32b879f2076bb1c52826af0c28ebf1aaeed (diff)
downloadcpython-a22ff8e11c114e0c4c54c57b9e7f7520db9d5163.zip
cpython-a22ff8e11c114e0c4c54c57b9e7f7520db9d5163.tar.gz
cpython-a22ff8e11c114e0c4c54c57b9e7f7520db9d5163.tar.bz2
gh-105578: Document that `AnyStr` is deprecated in py313 (#107116)
It will not be removed until Python 3.18.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/typing.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 539203f..f96a805 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -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.
@@ -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`