We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1402b9 commit 8a4cdc4Copy full SHA for 8a4cdc4
Lib/inspect.py
@@ -819,9 +819,9 @@ def getfile(object):
819
if ismodule(object):
820
if getattr(object, '__file__', None):
821
return object.__file__
822
- if object.__spec__ is not None:
+ if getattr(object, '__spec__', None) is not None:
823
raise TypeError(f'{object!r} is a built-in module')
824
- raise TypeError(f'Custom module: {object!r} cannot get source')
+ raise TypeError(f'Cannot get source from {object!r}')
825
if isclass(object):
826
if hasattr(object, '__module__'):
827
module = sys.modules.get(object.__module__)
0 commit comments