[issue44648] Inspect.getsource raises wrong error on classes in interactive session
Łukasz Langa
report at bugs.python.org
Fri Jul 16 09:54:29 EDT 2021
Łukasz Langa <lukasz at langa.pl> added the comment:
Why do you think OSError fits here? Since objects provided on the command line by definition cannot have source code files, the problem isn't that the file is missing or inaccessible. Rather, the value provided to getsource() is wrong. So, in my view, this should rather be ValueError.
Moreover, checking for __main__ is insufficient as there are __main__.py modules after all in many packages.
----------
nosy: +lukasz.langa
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44648>
_______________________________________
More information about the Python-bugs-list
mailing list