diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2021-07-30 17:17:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 17:17:46 (GMT) |
commit | 48a62559dfaf775e4f1cc56b19379c799e8e2587 (patch) | |
tree | 15ed7b890311a2ac6b486db2ad777477227ca501 /Lib/inspect.py | |
parent | ceea579ccc51791f3e115155d6f27905bc7544a9 (diff) | |
download | cpython-48a62559dfaf775e4f1cc56b19379c799e8e2587.zip cpython-48a62559dfaf775e4f1cc56b19379c799e8e2587.tar.gz cpython-48a62559dfaf775e4f1cc56b19379c799e8e2587.tar.bz2 |
bpo-44648: Fix error type in inspect.getsource() in interactive session (GH-27171)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 7e9f7ce..a5f0352 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -781,6 +781,8 @@ def getfile(object): module = sys.modules.get(object.__module__) if getattr(module, '__file__', None): return module.__file__ + if object.__module__ == '__main__': + raise OSError('source code not available') raise TypeError('{!r} is a built-in class'.format(object)) if ismethod(object): object = object.__func__ |