[New-bugs-announce] [issue27494] 2to3 parser failure caused by a comma after a generator expression
Jakub Stasiak
report at bugs.python.org
Tue Jul 12 06:29:13 EDT 2016
New submission from Jakub Stasiak:
Test file (test.py):
print(set(x for x in range(2),))
Python runs it nicely:
% python2 test.py
set([0, 1])
% python3 test.py
{0, 1}
2to3 parser (on both Python 2.7.11 and 3.5.2) chokes on it though:
% /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin/2to3 test.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Can't parse test.py: ParseError: bad input: type=8, value=u')', context=('', (1, 30))
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse test.py: ParseError: bad input: type=8, value=u')', context=('', (1, 30))
% /usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/bin/2to3 test.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Can't parse test.py: ParseError: bad input: type=8, value=')', context=('', (1, 30))
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse test.py: ParseError: bad input: type=8, value=')', context=('', (1, 30))
For reference: https://github.com/smarkets/flake8-strict/issues/9 (project using lib2to3 parser)
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 270236
nosy: jstasiak
priority: normal
severity: normal
status: open
title: 2to3 parser failure caused by a comma after a generator expression
type: crash
versions: Python 2.7, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27494>
_______________________________________
More information about the New-bugs-announce
mailing list