-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
>>> 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
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
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error