Serhiy Storchaka added the comment:
> How about raising a TypeError if ``all(isinstance(l, str) for l in
> fromlist)`` is False? That would make the exception message less clearer
> since we can't include the "[...] not 'bytes'" part though.
for l in fromlist:
if not isinstance(l, str):
Note also that you can get an arbitrary error if fromlist is not a sequence.
Actually this issue doesn't look very important for Python 3, since it is
unlikely that non-string is passed in fromlist. Unlike to Python 2 where you
can pass unicode if just use unicode_literals. Other solution for Python 2 is
allowing unicode in fromlist. Perhaps this would increase compatibility with
title: "TypeError: Item in ``from list'' not a string" message -> "TypeError:
Item in ``from list'' not a string" message
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list