Issue 30355: Unicode symbols crash lib2to3.parse (original) (raw)

Issue30355

Created on 2017-05-12 21:26 by Yann Grisel, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg293573 - (view) Author: Yann Grisel (Yann Grisel) Date: 2017-05-12 21:26
The code formatter YAPF relies on lib2to3 to parse the code before formatting it. The function "classify" from "lib2to3/pgen2/parse.py" returns a ParseError when encountering unicode variable names (like Δ), which it should not.
msg293601 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-13 07:59
Why? Unicode identifiers are not allowed in 2.x. I don't think lib2to3 is able or responsible to parse invalid syntax source codes.
msg293965 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-19 19:06
I agree. Δ is not a 2.x identifier (variable name) or anything else (like 'binary operator') and it would be wrong for lib2to3.pgen2.parse.classify to classify it is such, or as anything else. So I am closing this. Benjamin can reopen if we are mistaken.
History
Date User Action Args
2022-04-11 14:58:46 admin set github: 74540
2017-05-19 19:06:27 terry.reedy set status: open -> closedtype: behaviornosy: + terry.reedy, benjamin.petersonmessages: + resolution: not a bugstage: resolved
2017-05-13 07:59:44 xiang.zhang set nosy: + xiang.zhangmessages: +
2017-05-12 21:26:00 Yann Grisel create