diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-11-02 21:55:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 21:55:51 (GMT) |
commit | a459a81530de700b3d3faeb827b22ed1c9985812 (patch) | |
tree | e2c3dd533b12c74bf5d50689d6dbb48ff95de56b /Lib/inspect.py | |
parent | 48824fa1e26595ac97ffc96ee2c3d32ff130c420 (diff) | |
download | cpython-a459a81530de700b3d3faeb827b22ed1c9985812.zip cpython-a459a81530de700b3d3faeb827b22ed1c9985812.tar.gz cpython-a459a81530de700b3d3faeb827b22ed1c9985812.tar.bz2 |
bpo-45406: make inspect.getmodule() return None when getabsfile() raises FileNotFoundError (GH-28824)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 14a42fd..dd89111 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -858,7 +858,7 @@ def getmodule(object, _filename=None): # Try the cache again with the absolute file name try: file = getabsfile(object, _filename) - except TypeError: + except (TypeError, FileNotFoundError): return None if file in modulesbyfile: return sys.modules.get(modulesbyfile[file]) |