Issue 8892: 2to3 fails with assertion failure on "from itertools import *" (original) (raw)

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 )