Commits

Armin Rigo committed 3aa8d35

Don't crash when hitting ImportError when trying to import a built-in
module. This can occur with 'cppyy'.

  • Participants
  • Parent commits defc922

Comments (0)

Files changed (1)

lib-python/2.7/pydoc.py

                 if key is None:
                     callback(None, modname, '')
                 else:
-                    desc = split(__import__(modname).__doc__ or '', '\n')[0]
+                    try:
+                        module_doc = __import__(modname).__doc__
+                    except ImportError:
+                        module_doc = None
+                    desc = split(module_doc or '', '\n')[0]
                     if find(lower(modname + ' - ' + desc), key) >= 0:
                         callback(None, modname, desc)