classification
Title: 2to3 parser failure caused by a comma after a generator expression
Type: crash Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jayvdb, jstasiak
Priority: normal Keywords:

Created on 2016-07-12 10:29 by jstasiak, last changed 2017-02-15 22:03 by jstasiak.

Pull Requests
URL Status Linked Edit
PR 60 open jstasiak, 2017-02-15 21:42
Messages (1)
msg270236 - (view) Author: Jakub Stasiak (jstasiak) * Date: 2016-07-12 10:29
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)
History
Date User Action Args
2017-02-15 22:03:42jstasiaksetversions: + Python 3.6, Python 3.7
2017-02-15 21:42:37jstasiaksetpull_requests: + pull_request87
2016-07-12 10:34:44jayvdbsetnosy: + jayvdb
2016-07-12 10:29:13jstasiakcreate