diff options
| author | Alexander Smirnov <[email protected]> | 2024-06-18 08:31:45 +0000 |
|---|---|---|
| committer | Alexander Smirnov <[email protected]> | 2024-06-18 08:31:45 +0000 |
| commit | 8da3a80eb37bb357a4a994464851104565fd9490 (patch) | |
| tree | 021aa0770c7bb74d27d8731629ce6f5abd1e84e9 /contrib/python/ipython/py3/IPython/core/completerlib.py | |
| parent | 05cc35d98bf2bd929c00b02fcd98fd65a1b676ad (diff) | |
| parent | d68a678bf36d213cb890d8bdfbdf34df6a40f8c1 (diff) | |
Merge branch 'rightlib' into mergelibs-240618-0830
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core/completerlib.py')
| -rw-r--r-- | contrib/python/ipython/py3/IPython/core/completerlib.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/completerlib.py b/contrib/python/ipython/py3/IPython/core/completerlib.py index de6c4249b01..05f39e50159 100644 --- a/contrib/python/ipython/py3/IPython/core/completerlib.py +++ b/contrib/python/ipython/py3/IPython/core/completerlib.py @@ -199,9 +199,14 @@ def get_root_modules(): return rootmodules -def is_importable(module, attr, only_modules): +def is_importable(module, attr: str, only_modules) -> bool: if only_modules: - return inspect.ismodule(getattr(module, attr)) + try: + mod = getattr(module, attr) + except ModuleNotFoundError: + # See gh-14434 + return False + return inspect.ismodule(mod) else: return not(attr[:2] == '__' and attr[-2:] == '__') |
