diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-30 17:46:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 17:46:42 (GMT) |
commit | f468ede4a2b7ab5c72ae85ab04cb56904300cd23 (patch) | |
tree | aac90287c84307d96c2f8319901b1dfb589748fd /Lib/inspect.py | |
parent | 440c9f772a9b66c1ea387c1c3efc9ff438880acf (diff) | |
download | cpython-f468ede4a2b7ab5c72ae85ab04cb56904300cd23.zip cpython-f468ede4a2b7ab5c72ae85ab04cb56904300cd23.tar.gz cpython-f468ede4a2b7ab5c72ae85ab04cb56904300cd23.tar.bz2 |
bpo-44648: Fix error type in inspect.getsource() in interactive session (GH-27171) (GH-27495)
(cherry picked from commit 48a62559dfaf775e4f1cc56b19379c799e8e2587)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
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 750fd45..7aedcf1 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__ |