[New-bugs-announce] [issue3836] 2to3 broken due to mixed 2.5 and 3.0 syntax

Haoyu Bai report at bugs.python.org
Thu Sep 11 18:12:07 CEST 2008

New submission from Haoyu Bai <divinekid at gmail.com>:

In the py3k SVN head(r66389) of lib2to3, the main.py used Python 2.x's
print syntax, and the refactor.py used Python 3.0's exception syntax. So
the 2to3 finally broken on both Python 2.5 and 3.0.

Well, it able to run with Python 2.6, but also have a lot of errors like

Traceback (most recent call last):
  File "/usr/bin/2to3", line 6, in <module>
  File "/home/kid/python-site/lib2to3/main.py", line 71, in main
    rt = refactor.RefactoringTool(fixer_names, rt_opts, explicit=explicit)
  File "/home/kid/python-site/lib2to3/refactor.py", line 119, in __init__
    self.pre_order, self.post_order = self.get_fixers()
  File "/home/kid/python-site/lib2to3/refactor.py", line 138, in get_fixers
    mod = __import__(fix_mod_path, {}, {}, ["*"])
  File "/home/kid/python-site/lib2to3/fixes/fix_dict.py", line 38, in
    class FixDict(fixer_base.BaseFix):
  File "/home/kid/python-site/lib2to3/fixes/fix_dict.py", line 76, in
    p1 = patcomp.compile_pattern(P1)
  File "/home/kid/python-site/lib2to3/patcomp.py", line 186, in
    return PatternCompiler().compile_pattern(pattern)
  File "/home/kid/python-site/lib2to3/patcomp.py", line 57, in
    root = self.driver.parse_tokens(tokens, debug=debug)
  File "/home/kid/python-site/lib2to3/pgen2/driver.py", line 45, in
    for quintuple in tokens:
  File "/home/kid/python-site/lib2to3/patcomp.py", line 34, in
    tokens = tokenize.generate_tokens(driver.generate_lines(input).__next__)
AttributeError: 'generator' object has no attribute '__next__'

assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 73037
nosy: bhy, collinwinter
severity: normal
status: open
title: 2to3 broken due to mixed 2.5 and 3.0 syntax
type: crash

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list