[issue9221] 2to3 fails to parse a for construct

Tiago Antao report at bugs.python.org
Sat Jul 10 22:12:28 CEST 2010


New submission from Tiago Antao <tiagoantao at gmail.com>:

2to3 crashes with a apparently simple for.
An example is presented (the first line is actually enough)

        >>> for clade in tree.find_clades(branch_length=True, order='level'):
        >>>     if (clade.branch_length < .5 and
        >>>         not clade.is_terminal() and
        >>>         clade is not self.root):
        >>>         tree.collapse(clade)

The stack is shown below. It almost seems a problem with newline conversion at the end?

RefactoringTool: Can't parse docstring in xx2 line 1: ParseError: bad input: type=0, value='', context=('', (2, 0))
RefactoringTool: Can't parse docstring in xx2 line 2: ParseError: bad input: type=5, value='    ', context=('\n', (2, 0))
RefactoringTool: Can't parse docstring in xx2 line 3: ParseError: bad input: type=5, value='        ', context=('\n\n', (3, 0))
RefactoringTool: Can't parse docstring in xx2 line 4: ParseError: bad input: type=5, value='        ', context=('\n\n\n', (4, 0))
RefactoringTool: Can't parse docstring in xx2 line 5: ParseError: bad input: type=5, value='        ', context=('\n\n\n\n', (5, 0))
RefactoringTool: No files need to be modified.

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 109929
nosy: tiagoantao
priority: normal
severity: normal
status: open
title: 2to3 fails to parse a for construct
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9221>
_______________________________________


More information about the Python-bugs-list mailing list