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.

Author berker.peksag
Recipients Julian.Gindi, Tim.Graham, berker.peksag, bignose, brett.cannon,, eric.snow, ezio.melotti, ncoghlan, rhettinger, serhiy.storchaka
Date 2016-10-12.10:48:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Well, I find using a for loop is a bit verbose in this case :)

In Python 3.2:

>>> __import__('encodings', fromlist=[b'aliases'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Item in ``from list'' not a string

BytesWarning is there since Python 3.3 and I couldn't find any report on the tracker. I'd be fine with either committing the current patch or using pre-importlib exception message from 3.2 in 3.5+ (assuming the chance of passing a non-str item is low in Python 3)

> Other solution for Python 2 is allowing unicode in fromlist.

My preference is to improve the exception message and move on. Accepting both str and unicode would make the code harder to maintain and it would be better to avoid potential regressions in 2.7 (note that we already introduced regressions in the previous bugfix releases :))
Date User Action Args
2016-10-12 10:48:55berker.peksagsetrecipients: + berker.peksag, brett.cannon, rhettinger, ncoghlan, ezio.melotti, bignose, eric.snow, serhiy.storchaka, Julian.Gindi,, Tim.Graham
2016-10-12 10:48:55berker.peksagsetmessageid: <>
2016-10-12 10:48:55berker.peksaglinkissue21720 messages
2016-10-12 10:48:54berker.peksagcreate