Title: Remove the 2to3 program and the lib2to3 module · Issue #104780 · python/cpython · GitHub
Open Graph Title: Remove the 2to3 program and the lib2to3 module · Issue #104780 · python/cpython
X Title: Remove the 2to3 program and the lib2to3 module · Issue #104780 · python/cpython
Description: 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 p...
Open Graph Description: 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 know...
X Description: 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 know...
Opengraph URL: https://github.com/python/cpython/issues/104780
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remove the 2to3 program and the lib2to3 module","articleBody":"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](https://peps.python.org/pep-0617/) was approved.\r\n\r\nThe 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``).\r\n\r\nOne of a famous user of lib2to3 was the [black project](https://github.com/psf/black) but they decided to fork lib2to3 and their fork was made compatible with Python 3.10 grammar (maybe also Python 3.11).\r\n\r\nI 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).\r\n\r\ncc @isidentical @lysnikolaou @pablogsal @ambv \r\n\r\n---\r\n\r\nExample of valid Python script (``script.py``:\r\n\r\n```py\r\nwith (open(__file__) as fp): data=fp.read()\r\nprint(len(data))\r\n```\r\n\r\nIt works well on Python 3.11:\r\n\r\n```\r\n$ python3.11 script.py \r\n61\r\n```\r\n\r\nBut lib2to3 is unable to parse it:\r\n\r\n```\r\n$ python3.11 -m lib2to3 script.py \r\n(...)\r\nRefactoringTool: No files need to be modified.\r\nRefactoringTool: There was 1 error:\r\nRefactoringTool: Can't parse script.py: ParseError: bad input: type=1, value='as', context=(' ', (1, 21))\r\n```\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-104781\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-05-23T01:36:02Z","url":"https://github.com/python/cpython/issues/104780"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bbf94ac2-9564-9348-68a3-948bf969cf15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF6A:16E4ED:19110C4:1F530B3:6B0269A0 |
| html-safe-nonce | 40c30b9f860b844103ebe3d4b8f2eed56950f282d5bb7e6904df35a1ac99ec5f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjZBOjE2RTRFRDoxOTExMEM0OjFGNTMwQjM6NkIwMjY5QTAiLCJ2aXNpdG9yX2lkIjoiNzM5Njg4ODk1NDk1MzQyNzM2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 688a59c2393911d8fc464b46bc4a17cc3da3cca9d20f114569bdb8869ac44066 |
| hovercard-subject-tag | issue:1720983177 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/104780/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a916f908b8f3e546c07aa24f63a064354c728dc102f6c8451d6ed6e722dc7b06/python/cpython/issues/104780 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a916f908b8f3e546c07aa24f63a064354c728dc102f6c8451d6ed6e722dc7b06/python/cpython/issues/104780 |
| og:image:alt | 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 know... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width