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 <rep...@bugs.python.org> <http://bugs.python.org/issue31285> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com