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: "from itertools imoprt *" crashes 2to3
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ronaldoussoren
Priority: normal Keywords:

Created on 2010-07-13 11:58 by ronaldoussoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg110175 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-13 11:58
a script containing the following line crashes 2to3 with an assertion error.

The line:

  from itertools import *


File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/fixes/fix_itertools_imports.py", line 24, in transform
    assert child.type == syms.import_as_name
AssertionError
msg110179 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-13 12:27
A related issue:

   from itertools import chain, izip, imap

This results in an invalid transformation:


-from itertools import chain, izip, imap
+from itertools import chain,


The translated version is an invalid import statement with a ',' at the end of the line.

A workaround for the first issue: use explicit imports. A workaround for this one: use "from itertools import izip, imap, chain".
msg110230 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-07-13 21:28
Star import problem was already fixed. Snared the other one in r82855.
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53491
2010-07-13 21:28:04benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg110230
2010-07-13 14:11:02r.david.murraysettype: behavior
versions: + Python 3.1
2010-07-13 14:10:29r.david.murraysetnosy: + benjamin.peterson
2010-07-13 12:27:38ronaldoussorensetmessages: + msg110179
2010-07-13 11:58:34ronaldoussorencreate