python2/python-2.7-fix-2to3-itertools-import-star.patch
dmalcolm cff1b4f3d9 - re-enable systemtap
- cherrypick upstream patch to 2to3 for "from itertools import *" traceback
    (patch 123)
2010-07-26 13:04:32 +00:00

31 lines
1.1 KiB
Diff

Index: lib2to3/tests/test_fixers.py
===================================================================
--- lib2to3/tests/test_fixers.py (revision 82529)
+++ lib2to3/tests/test_fixers.py (revision 82530)
@@ -3670,7 +3670,11 @@
a = "from itertools import bar, filterfalse, foo"
self.check(b, a)
+ def test_import_star(self):
+ s = "from itertools import *"
+ self.unchanged(s)
+
def test_unchanged(self):
s = "from itertools import foo"
self.unchanged(s)
Index: lib2to3/fixes/fix_itertools_imports.py
===================================================================
--- lib2to3/fixes/fix_itertools_imports.py (revision 82529)
+++ lib2to3/fixes/fix_itertools_imports.py (revision 82530)
@@ -20,6 +20,9 @@
if child.type == token.NAME:
member = child.value
name_node = child
+ elif child.type == token.STAR:
+ # Just leave the import as is.
+ return
else:
assert child.type == syms.import_as_name
name_node = child.children[0]