GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove the 2to3 program and the lib2to3 module · Issue #104780 · python/cpython

Remove the 2to3 program and the lib2to3 module #104780

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove the 2to3 program and the lib2to3 module#104780
Copy link

Description

@vstinner
vstinner
opened on May 23, 2023
Issue body actions

The 2to3 program is implemented with the lib2to3 module which implements a parser of the Python language. Problem: this parser is unable to parse Python 3.10 grammar :-( This issue was already known in Python 3.9 when PEP 617 – New PEG parser for CPython was approved.

The 2to3 program and the lib2to3 were marked as "pending" deprecated since Python 3.9, and then officially deprecated in Python 3.11 (import lib2to3 emits a DeprecationWarning).

One of a famous user of lib2to3 was the black project but they decided to fork lib2to3 and their fork was made compatible with Python 3.10 grammar (maybe also Python 3.11).

I propose to remove 2to3 and lib2to3 at the beginning of the Python 3.13 development cycle to give users more time to be prepared for this incompatible change before Python 3.13 final release (scheduled in October 2024).

cc @isidentical @lysnikolaou @pablogsal @ambv


Example of valid Python script (script.py:

with (open(__file__) as fp): data=fp.read()
print(len(data))

It works well on Python 3.11:

$ python3.11 script.py 
61

But lib2to3 is unable to parse it:

$ python3.11 -m lib2to3 script.py 
(...)
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse script.py: ParseError: bad input: type=1, value='as', context=(' ', (1, 21))

Linked PRs

  • gh-104780: Remove 2to3 program and lib2to3 module #104781
Reacted by Oleg Iarygin, James De Bias and Gregory P. Smith

Activity

  1. vstinner
    added 2 commits that reference this issue on May 23, 2023

    pythongh-104780: Remove 2to3 program and lib2to3 module

    e1ffa37

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

    ae00b81
  2. vstinner commented on May 23, 2023

    @vstinner
    vstinner
    on May 23, 2023
    MemberAuthor
    More actions

    Done by ae00b81

  3. hugovk commented on May 23, 2023

    @hugovk
    hugovk
    on May 23, 2023
    Member
    More actions

    Wow!

    +26 -21,000

    (I think this issue can be closed, please re-open otherwise :)

  4. hugovk
    closed this as completedon May 23, 2023
  5. vstinner commented on May 24, 2023

    @vstinner
    vstinner
    on May 24, 2023
    MemberAuthor
    More actions

    lib2to3 was deprecated in Python 3.11 by issue #84540.

  6. DenisDupeyron
    added 3 commits that reference this issue on Aug 30, 2024

    2to3 was removed from Python 3.13 (python/cpython#104780)

    c14463e

    2to3 was removed from Python 3.13 (python/cpython#104780)

    35568a6

    Merge pull request #22 from anaconda/2to3_was_removed

    5a7e76e
  7. cbouss
    added a commit that references this issue on Sep 19, 2024

    2to3 was removed from Python 3.13 (python/cpython#104780)

    8880579
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.