Author berker.peksag
Recipients Julian.Gindi, Tim.Graham, berker.peksag, bignose, brett.cannon, davidszotten@gmail.com, 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 <1476269335.08.0.693613646036.issue21720@psf.upfronthosting.co.za>
In-reply-to
Content
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 :))
History
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, davidszotten@gmail.com, Tim.Graham
2016-10-12 10:48:55berker.peksagsetmessageid: <1476269335.08.0.693613646036.issue21720@psf.upfronthosting.co.za>
2016-10-12 10:48:55berker.peksaglinkissue21720 messages
2016-10-12 10:48:54berker.peksagcreate