From d2ab48baeac9bf22fd49740c40da296d3a3a5640 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Tue, 21 Apr 2020 21:59:01 -0700 Subject: [PATCH 1/2] bpo-40360: Prepare to deprecate lib2to3. --- Doc/library/2to3.rst | 11 +++++++++++ Lib/lib2to3/__init__.py | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst index eb4c9185f48bf2..9d4ed888f1b25b 100644 --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -3,6 +3,12 @@ 2to3 - Automated Python 2 to 3 code translation =============================================== +.. deprecated:: 3.9 + The :mod:`lib2to3` package and related 2to3 tool are pending deprecation + and removal by Python 3.11 or 3.12. We anticipate that a fork of it may + live on as an external package on PyPI as it does have use as a Python to + Python source transformation tool. + .. sectionauthor:: Benjamin Peterson 2to3 is a Python program that reads Python 2.x source code and applies a series @@ -462,6 +468,11 @@ and off individually. They are described here in more detail. .. moduleauthor:: Collin Winter .. moduleauthor:: Benjamin Peterson +.. deprecated:: 3.9 + The :mod:`lib2to3` package and related 2to3 tool are pending deprecation + and removal by Python 3.11 or 3.12. We anticipate that a fork of it may + live on as an external package on PyPI. + **Source code:** :source:`Lib/lib2to3/` -------------- diff --git a/Lib/lib2to3/__init__.py b/Lib/lib2to3/__init__.py index ea30561d839798..29348d91d409fe 100644 --- a/Lib/lib2to3/__init__.py +++ b/Lib/lib2to3/__init__.py @@ -1 +1,5 @@ -#empty +import warnings +warnings.warn( + "lib2to3 is pending deprecation for removal in Python 3.11 or 3.12.", + category=PendingDeprecationWarning) +del warnings From ee7c4484208b365ef5b406102b2b7cded824cb2d Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Tue, 21 Apr 2020 22:04:59 -0700 Subject: [PATCH 2/2] NEWS --- .../next/Library/2020-04-21-22-04-57.bpo-40360.qCpoH8.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2020-04-21-22-04-57.bpo-40360.qCpoH8.rst diff --git a/Misc/NEWS.d/next/Library/2020-04-21-22-04-57.bpo-40360.qCpoH8.rst b/Misc/NEWS.d/next/Library/2020-04-21-22-04-57.bpo-40360.qCpoH8.rst new file mode 100644 index 00000000000000..9d06640b48d394 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-04-21-22-04-57.bpo-40360.qCpoH8.rst @@ -0,0 +1,2 @@ +lib2to3 and the 2to3 tool gain a PendingDeprecationWarning, slated for +removal in 3.11 or 3.12.