[issue21720] "TypeError: Item in ``from list'' not a string" message

Serhiy Storchaka report at bugs.python.org
Wed Oct 25 01:41:11 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I don't think the index in error message is needed. Unlike to str.join() which accepts arbitrary iterables of arbitrary names, the fromlist usually is a short tuple.

Interesting, what happen if the fromlist is not a list or tuple?

>>> __import__('encodings', fromlist=iter(('aliases', b'codecs')))
<module 'encodings' from '/home/serhiy/py/cpython/Lib/encodings/__init__.py'>

Import is successful because the iterator was exhausted by "'*' in fromlist".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21720>
_______________________________________


More information about the Python-bugs-list mailing list