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 ncoghlan
Recipients Julian.Gindi, Tim.Graham, berker.peksag, bignose, brett.cannon, davidszotten@gmail.com, eric.snow, ezio.melotti, ncoghlan, rhettinger
Date 2016-10-09.02:52:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1475981531.81.0.645193700737.issue21720@psf.upfronthosting.co.za>
In-reply-to
Content
Berker's fix for Python 2.7 looks good to me.

However, Python 3 has a comparably vague error message, it's just inverted to complain about bytes rather than unicode due to the change in the native str type:

>>> __import__('encodings', fromlist=[b'aliases'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1013, in _handle_fromlist
TypeError: hasattr(): attribute name must be string

hasattr() in Python 2.7 is similarly unhelpful regarding what type it actually got when you give it something it doesn't expect.
History
Date User Action Args
2016-10-09 02:52:12ncoghlansetrecipients: + ncoghlan, brett.cannon, rhettinger, ezio.melotti, bignose, eric.snow, berker.peksag, Julian.Gindi, davidszotten@gmail.com, Tim.Graham
2016-10-09 02:52:11ncoghlansetmessageid: <1475981531.81.0.645193700737.issue21720@psf.upfronthosting.co.za>
2016-10-09 02:52:11ncoghlanlinkissue21720 messages
2016-10-09 02:52:10ncoghlancreate