Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-104780: Remove 2to3 program and lib2to3 module #104781

Merged
merged 7 commits into from
May 23, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 23, 2023

  • Remove the Tools/scripts/2to3 script.
  • Remove the Lib/test/test_lib2to3/ directory.
  • Doc/tools/extensions/pyspecific.py: remove the "2to3fixer" object type.
  • Makefile and PC/layout/main.py no longer compile lib2to3 grammar files.
  • Update Makefile for 2to3 removal.

📚 Documentation preview 📚: https://cpython-previews--104781.org.readthedocs.build/

* Remove the Tools/scripts/2to3 script.
* Remove the Lib/test/test_lib2to3/ directory.
* Doc/tools/extensions/pyspecific.py: remove the "2to3fixer" object
  type.
* Makefile and PC/layout/main.py no longer compile lib2to3 grammar
  files.
* Update Makefile for 2to3 removal.
@vstinner
Copy link
Member Author

This PR is quite big, it changes 129 files:

git diff:
 .gitignore                                         |    1 -
 Doc/glossary.rst                                   |    9 -
 Doc/library/2to3.rst                               |  489 --
 Doc/library/development.rst                        |    4 +-
 Doc/tools/.nitignore                               |    1 -
 Doc/tools/extensions/pyspecific.py                 |    1 -
 Doc/whatsnew/3.13.rst                              |    3 +
 Lib/lib2to3/Grammar.txt                            |  196 -
 Lib/lib2to3/PatternGrammar.txt                     |   28 -
 Lib/lib2to3/__init__.py                            |    8 -
 Lib/lib2to3/__main__.py                            |    4 -
 Lib/lib2to3/btm_matcher.py                         |  163 -
 Lib/lib2to3/btm_utils.py                           |  280 --
 Lib/lib2to3/fixer_base.py                          |  186 -
 Lib/lib2to3/fixer_util.py                          |  453 --
 Lib/lib2to3/fixes/__init__.py                      |    1 -
 Lib/lib2to3/fixes/fix_apply.py                     |   68 -
 Lib/lib2to3/fixes/fix_asserts.py                   |   34 -
 Lib/lib2to3/fixes/fix_basestring.py                |   14 -
 Lib/lib2to3/fixes/fix_buffer.py                    |   22 -
 Lib/lib2to3/fixes/fix_dict.py                      |  106 -
 Lib/lib2to3/fixes/fix_except.py                    |   93 -
 Lib/lib2to3/fixes/fix_exec.py                      |   39 -
 Lib/lib2to3/fixes/fix_execfile.py                  |   53 -
 Lib/lib2to3/fixes/fix_exitfunc.py                  |   72 -
 Lib/lib2to3/fixes/fix_filter.py                    |   94 -
 Lib/lib2to3/fixes/fix_funcattrs.py                 |   21 -
 Lib/lib2to3/fixes/fix_future.py                    |   22 -
 Lib/lib2to3/fixes/fix_getcwdu.py                   |   19 -
 Lib/lib2to3/fixes/fix_has_key.py                   |  109 -
 Lib/lib2to3/fixes/fix_idioms.py                    |  152 -
 Lib/lib2to3/fixes/fix_import.py                    |   99 -
 Lib/lib2to3/fixes/fix_imports.py                   |  145 -
 Lib/lib2to3/fixes/fix_imports2.py                  |   16 -
 Lib/lib2to3/fixes/fix_input.py                     |   26 -
 Lib/lib2to3/fixes/fix_intern.py                    |   39 -
 Lib/lib2to3/fixes/fix_isinstance.py                |   52 -
 Lib/lib2to3/fixes/fix_itertools.py                 |   43 -
 Lib/lib2to3/fixes/fix_itertools_imports.py         |   57 -
 Lib/lib2to3/fixes/fix_long.py                      |   19 -
 Lib/lib2to3/fixes/fix_map.py                       |  110 -
 Lib/lib2to3/fixes/fix_metaclass.py                 |  228 -
 Lib/lib2to3/fixes/fix_methodattrs.py               |   24 -
 Lib/lib2to3/fixes/fix_ne.py                        |   23 -
 Lib/lib2to3/fixes/fix_next.py                      |  103 -
 Lib/lib2to3/fixes/fix_nonzero.py                   |   21 -
 Lib/lib2to3/fixes/fix_numliterals.py               |   28 -
 Lib/lib2to3/fixes/fix_operator.py                  |   97 -
 Lib/lib2to3/fixes/fix_paren.py                     |   44 -
 Lib/lib2to3/fixes/fix_print.py                     |   87 -
 Lib/lib2to3/fixes/fix_raise.py                     |   90 -
 Lib/lib2to3/fixes/fix_raw_input.py                 |   17 -
 Lib/lib2to3/fixes/fix_reduce.py                    |   35 -
 Lib/lib2to3/fixes/fix_reload.py                    |   36 -
 Lib/lib2to3/fixes/fix_renames.py                   |   70 -
 Lib/lib2to3/fixes/fix_repr.py                      |   23 -
 Lib/lib2to3/fixes/fix_set_literal.py               |   53 -
 Lib/lib2to3/fixes/fix_standarderror.py             |   18 -
 Lib/lib2to3/fixes/fix_sys_exc.py                   |   30 -
 Lib/lib2to3/fixes/fix_throw.py                     |   56 -
 Lib/lib2to3/fixes/fix_tuple_params.py              |  175 -
 Lib/lib2to3/fixes/fix_types.py                     |   61 -
 Lib/lib2to3/fixes/fix_unicode.py                   |   42 -
 Lib/lib2to3/fixes/fix_urllib.py                    |  196 -
 Lib/lib2to3/fixes/fix_ws_comma.py                  |   39 -
 Lib/lib2to3/fixes/fix_xrange.py                    |   73 -
 Lib/lib2to3/fixes/fix_xreadlines.py                |   25 -
 Lib/lib2to3/fixes/fix_zip.py                       |   46 -
 Lib/lib2to3/main.py                                |  273 --
 Lib/lib2to3/patcomp.py                             |  204 -
 Lib/lib2to3/pgen2/__init__.py                      |    4 -
 Lib/lib2to3/pgen2/conv.py                          |  257 --
 Lib/lib2to3/pgen2/driver.py                        |  177 -
 Lib/lib2to3/pgen2/grammar.py                       |  189 -
 Lib/lib2to3/pgen2/literals.py                      |   60 -
 Lib/lib2to3/pgen2/parse.py                         |  204 -
 Lib/lib2to3/pgen2/pgen.py                          |  386 --
 Lib/lib2to3/pgen2/token.py                         |   86 -
 Lib/lib2to3/pgen2/tokenize.py                      |  564 ---
 Lib/lib2to3/pygram.py                              |   43 -
 Lib/lib2to3/pytree.py                              |  853 ----
 Lib/lib2to3/refactor.py                            |  732 ---
 Lib/test/test_lib2to3/__init__.py                  |   11 -
 Lib/test/test_lib2to3/__main__.py                  |    4 -
 Lib/test/test_lib2to3/data/README                  |    6 -
 Lib/test/test_lib2to3/data/bom.py                  |    2 -
 Lib/test/test_lib2to3/data/crlf.py                 |    3 -
 Lib/test/test_lib2to3/data/different_encoding.py   |    6 -
 Lib/test/test_lib2to3/data/false_encoding.py       |    2 -
 Lib/test/test_lib2to3/data/fixers/bad_order.py     |    5 -
 .../test_lib2to3/data/fixers/myfixes/__init__.py   |    0
 .../data/fixers/myfixes/fix_explicit.py            |    6 -
 .../test_lib2to3/data/fixers/myfixes/fix_first.py  |    6 -
 .../test_lib2to3/data/fixers/myfixes/fix_last.py   |    7 -
 .../test_lib2to3/data/fixers/myfixes/fix_parrot.py |   13 -
 .../data/fixers/myfixes/fix_preorder.py            |    6 -
 Lib/test/test_lib2to3/data/fixers/no_fixer_cls.py  |    1 -
 .../test_lib2to3/data/fixers/parrot_example.py     |    2 -
 Lib/test/test_lib2to3/data/infinite_recursion.py   | 2669 -----------
 Lib/test/test_lib2to3/data/py2_test_grammar.py     |  971 ----
 Lib/test/test_lib2to3/data/py3_test_grammar.py     |  956 ----
 Lib/test/test_lib2to3/pytree_idempotency.py        |   94 -
 Lib/test/test_lib2to3/support.py                   |   69 -
 Lib/test/test_lib2to3/test_all_fixers.py           |   41 -
 Lib/test/test_lib2to3/test_fixers.py               | 4649 --------------------
 Lib/test/test_lib2to3/test_main.py                 |  139 -
 Lib/test/test_lib2to3/test_parser.py               |  718 ---
 Lib/test/test_lib2to3/test_pytree.py               |  472 --
 Lib/test/test_lib2to3/test_refactor.py             |  337 --
 Lib/test/test_lib2to3/test_util.py                 |  591 ---
 Lib/test/test_tools/test_sundry.py                 |    5 -
 Mac/BuildScript/scripts/postflight.framework       |    4 +-
 Mac/Makefile.in                                    |    2 -
 Makefile.pre.in                                    |   25 +-
 Misc/NEWS.d/3.8.0a1.rst                            |    4 +-
 .../2023-05-23-03-36-47.gh-issue-104780.P4e3Yf.rst |    2 +
 PC/layout/main.py                                  |   23 -
 PC/layout/support/props.py                         |    2 -
 PC/layout/support/python.props                     |    2 -
 Python/stdlib_module_names.h                       |    1 -
 Tools/README                                       |    3 +-
 Tools/msi/bundle/packagegroups/postinstall.wxs     |    2 +-
 Tools/msi/lib/lib_files.wxs                        |    4 -
 Tools/msi/msi.props                                |    5 +-
 Tools/peg_generator/Makefile                       |    3 +-
 Tools/peg_generator/scripts/benchmark.py           |    1 -
 Tools/scripts/2to3                                 |    5 -
 Tools/scripts/README                               |    1 -
 Tools/wasm/wasm_assets.py                          |    2 -
 129 files changed, 17 insertions(+), 20988 deletions(-)

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one nit.

Doc/whatsnew/3.11.rst Outdated Show resolved Hide resolved
Tools/README Outdated Show resolved Hide resolved
Copy link
Member

@zooba zooba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner merged commit ae00b81 into python:main May 23, 2023
@vstinner vstinner deleted the remove_2to3 branch May 23, 2023 17:40
@vstinner
Copy link
Member Author

Thanks for reviews. I wasn't sure about the VS project changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants