This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3 fails to parse a for construct
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, tiagoantao
Priority: normal Keywords:

Created on 2010-07-10 20:12 by tiagoantao, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg109929 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-10 20:12
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.
msg109931 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-10 20:19
You are supposed to use “...” on continuation lines, not “>>>”:
http://docs.python.org/glossary#term-1
http://docs.python.org/dev/library/doctest#how-are-docstring-examples-recognized

Please reopen it the problem persists after this change. Thank you!
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53467
2010-07-10 20:19:06eric.araujosetstatus: open -> closed

nosy: + eric.araujo
messages: + msg109931

resolution: not a bug
stage: resolved
2010-07-10 20:12:27tiagoantaocreate