From 88a6a544f6a26525e361c893f9e0fe5ef898c492 2018-07-14 06:47:20 From: Wei Yen Date: 2018-07-14 06:47:20 Subject: [PATCH] Ensure `try_import` does not fail on null module.__file__ --- diff --git a/IPython/core/completerlib.py b/IPython/core/completerlib.py index 3c66d73..eeb39a4 100644 --- a/IPython/core/completerlib.py +++ b/IPython/core/completerlib.py @@ -165,7 +165,7 @@ def try_import(mod: str, only_modules=False) -> List[str]: except: return [] - m_is_init = hasattr(m, '__file__') and '__init__' in m.__file__ + m_is_init = '__init__' in (getattr(m, '__file__', '') or '') completions = [] if (not hasattr(m, '__file__')) or (not only_modules) or m_is_init: