>>> import inspect
>>> import types
... custom_module = types.ModuleType('my_custom_module')
...
>>> inspect.getfile(custom_module)
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
inspect.getfile(custom_module)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/Users/yihong/repos/cpython/Lib/inspect.py", line 822, in getfile
raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'my_custom_module'> is a built-in module
Bug report
Bug description:
as the code it is a costom module but not a build-in module
the error message is wrong
CPython versions tested on:
CPython main branch
Operating systems tested on:
Other
Linked PRs