Skip to content

Commit

Permalink
Merge a9e2cd5 into 9d1587a
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Aug 3, 2020
2 parents 9d1587a + a9e2cd5 commit dddb46f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions jedi/inference/compiled/access.py
@@ -1,5 +1,6 @@
import inspect
import types
import traceback
import sys
import operator as op
from collections import namedtuple
Expand Down Expand Up @@ -117,13 +118,18 @@ def load_module(inference_state, dotted_name, sys_path):
__import__(dotted_name)
except ImportError:
# If a module is "corrupt" or not really a Python module or whatever.
print('Module %s not importable in path %s.' % (dotted_name, sys_path), file=sys.stderr)
warnings.warn(
"Module %s not importable in path %s." % (dotted_name, sys_path),
UserWarning,
stacklevel=2,
)
return None
except Exception:
# Since __import__ pretty much makes code execution possible, just
# catch any error here and print it.
import traceback
print("Cannot import:\n%s" % traceback.format_exc(), file=sys.stderr)
warnings.warn(
"Cannot import:\n%s" % traceback.format_exc(), UserWarning, stacklevel=2
)
return None
finally:
sys.path = temp
Expand Down

0 comments on commit dddb46f

Please sign in to comment.