classification
Title: 2to3 fails with assertion failure on "from itertools import *"
Type: Stage: test needed
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, dmalcolm
Priority: normal Keywords: patch

Created on 2010-06-03 22:20 by dmalcolm, last changed 2010-07-04 16:12 by benjamin.peterson. This issue is now closed.

Files
File name Uploaded Description Edit
itertools_import_star_reproducer.patch dmalcolm, 2010-06-03 22:22 Patch against trunk (r81679) adding a reproducer
Messages (3)
msg106991 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-06-03 22:20
fix_itertools_imports.py fails on a "*" import

2to3 fails on this code:
   from itertools import *

with a traceback:
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py", line 3680, in test_star
    self.warns_unchanged(s, "Cannot handle star imports")
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py", line 49, in warns_unchanged
    self.warns(before, before, message, unchanged=True)
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py", line 43, in warns
    tree = self._check(before, after)
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py", line 32, in _check
    tree = self.refactor.refactor_string(before, self.filename)
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 359, in refactor_string
    self.refactor_tree(tree, name)
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 393, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 417, in traverse_by
    new = fixer.transform(node, results)
  File "/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/fixes/fix_itertools_imports.py", line 24, in transform
    assert child.type == syms.import_as_name
AssertionError

(seen when running 2to3 on python-lxml ; see problem in downstream tracker: https://bugzilla.redhat.com/show_bug.cgi?id=600036 )
msg106992 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-06-03 22:22
I'm attaching a reproducer for the test suite (though not a fix)
msg109230 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-07-04 16:12
Fixed in r82530.
History
Date User Action Args
2010-07-04 16:12:59benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg109230
2010-07-04 15:07:06eric.araujosetassignee: benjamin.peterson

nosy: + benjamin.peterson
stage: test needed
2010-06-03 22:22:23dmalcolmsetfiles: + itertools_import_star_reproducer.patch
keywords: + patch
messages: + msg106992
2010-06-03 22:20:50dmalcolmcreate