From b52a8ab5cd66952839ada0843539b5564108a052 Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Sat, 15 Jun 2024 14:18:22 +0300 Subject: Intermediate changes --- contrib/python/ipython/py3/IPython/core/completerlib.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'contrib/python/ipython/py3/IPython/core/completerlib.py') 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:] == '__') -- cgit v1.3