[Python-checkins] gh-92332: Docs-only deprecation of `typing.Text` (GH-92351)

Fidget-Spinner webhook-mailer at python.org
Fri May 6 06:15:27 EDT 2022


https://github.com/python/cpython/commit/6f18b86fda516df9ba7614423ba5c8d0fcf366ba
commit: 6f18b86fda516df9ba7614423ba5c8d0fcf366ba
branch: main
author: Alex Waygood <Alex.Waygood at Gmail.com>
committer: Fidget-Spinner <kenjin4096 at gmail.com>
date: 2022-05-06T18:15:18+08:00
summary:

gh-92332: Docs-only deprecation of `typing.Text` (GH-92351)

Co-authored-by: Shantanu <12621235+hauntsaninja at users.noreply.github.com>

files:
A Misc/NEWS.d/next/Library/2022-05-05-22-46-52.gh-issue-92332.Fv9CJx.rst
M Doc/library/typing.rst
M Doc/whatsnew/3.11.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 88085594caaff..005a515234110 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -1976,6 +1976,11 @@ Other concrete types
 
    .. versionadded:: 3.5.2
 
+   .. deprecated:: 3.11
+      Python 2 is no longer supported, and most type checkers also no longer
+      support type checking Python 2 code. Users should now use
+      :class:`str` instead of ``Text`` wherever possible.
+
 Abstract Base Classes
 ---------------------
 
@@ -2687,3 +2692,5 @@ convenience. This is subject to change, and not all deprecations are listed.
 |  ``typing`` versions of standard | 3.9           | Undecided         | :pep:`585`     |
 |  collections                     |               |                   |                |
 +----------------------------------+---------------+-------------------+----------------+
+|  ``typing.Text``                 | 3.11          | Undecided         | :gh:`92332`    |
++----------------------------------+---------------+-------------------+----------------+
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 19ac8676ba638..f679100863a03 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -1202,6 +1202,12 @@ Deprecated
   For now, a deprecation warning is raised for such syntax.
   (Contributed by Serhiy Storchaka in :gh:`91760`.)
 
+* :class:`typing.Text`, which exists solely to provide compatibility support
+  between Python 2 and Python 3 code, is now deprecated. Its removal is
+  currently unplanned, but users are encouraged to use :class:`str` instead
+  wherever possible.
+  (Contributed by Alex Waygood in :gh:`92332`.)
+
 
 Removed
 =======
diff --git a/Misc/NEWS.d/next/Library/2022-05-05-22-46-52.gh-issue-92332.Fv9CJx.rst b/Misc/NEWS.d/next/Library/2022-05-05-22-46-52.gh-issue-92332.Fv9CJx.rst
new file mode 100644
index 0000000000000..1d055bb2b99f4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-05-05-22-46-52.gh-issue-92332.Fv9CJx.rst
@@ -0,0 +1,2 @@
+Deprecate :class:`typing.Text` (removal of the class is currently not
+planned). Patch by Alex Waygood.



More information about the Python-checkins mailing list