[issue31285] a SystemError and an assertion failure in warnings.warn_explicit()

Serhiy Storchaka report at bugs.python.org
Mon Aug 28 02:42:58 EDT 2017


Serhiy Storchaka added the comment:

An alternative solution is using str.splitlines(source) instead of source.splitlines(). It raises a TypeError if the argument is not a text string and always returns a list of strings.

According to the documentation get_source() must return a text string or None.

https://docs.python.org/3/library/importlib.html?highlight=get_source#importlib.abc.InspectLoader.get_source

----------
nosy: +brett.cannon, eric.snow, ncoghlan, serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31285>
_______________________________________


More information about the Python-bugs-list mailing list