-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
C: parserHow we parse code. Or fail to parse it.How we parse code. Or fail to parse it.S: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedThe changes in this design / enhancement issue have been accepted and can be implementedT: enhancementNew feature or requestNew feature or request
Description
Currently, Black uses a vendored version of lib2to3 for parsing. This works well for parsing Python 2 and early Python 3, but Python has now moved on to a PEG-based parser (PEP 617), and lib2to3 is no longer being maintained.
So we need a new parser. There are a few existing options that we could leverage (Parso, LibCST), but it's going to be a lot of work to do the migration. WE're doing some early brainstorming in a Google doc. This issue exists so that we have a public record that we know this is a problem.
Concrete pieces of syntax that are blocked by this new grammar include parenthesized context managers and the match statement in Python 3.10. (#2242 through #2586, #2667, #2758)
gpshead, graingert, joshsleeper, pawelrubin, bersbersbers and 24 morecooperlees, johnthagen, astrojuanlu, utkarshgupta137, joshsleeper and 9 morejoshsleeper, graingert, iago-lito, Zac-HD, kkirsche and 3 more
Metadata
Metadata
Assignees
Labels
C: parserHow we parse code. Or fail to parse it.How we parse code. Or fail to parse it.S: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedThe changes in this design / enhancement issue have been accepted and can be implementedT: enhancementNew feature or requestNew feature or request