forked from VimPlug/jedi
Make sure to not load unsafe modules anymore if they are not on the sys path, fixes #760
This commit is contained in:
@@ -142,7 +142,7 @@ class InferenceState(object):
|
||||
|
||||
def get_sys_path(self, **kwargs):
|
||||
"""Convenience function"""
|
||||
return self.project._get_sys_path(self, environment=self.environment, **kwargs)
|
||||
return self.project._get_sys_path(self, **kwargs)
|
||||
|
||||
def infer(self, context, name):
|
||||
def_ = name.get_definition(import_name_always=True)
|
||||
|
||||
@@ -454,8 +454,12 @@ def _load_python_module(inference_state, file_io,
|
||||
|
||||
|
||||
def _load_builtin_module(inference_state, import_names=None, sys_path=None):
|
||||
project = inference_state.project
|
||||
if sys_path is None:
|
||||
sys_path = inference_state.get_sys_path()
|
||||
if not project._load_unsafe_extensions:
|
||||
safe_paths = project._get_base_sys_path(inference_state)
|
||||
sys_path = [p for p in sys_path if p in safe_paths]
|
||||
|
||||
dotted_name = '.'.join(import_names)
|
||||
assert dotted_name is not None
|
||||
|
||||
Reference in New Issue
Block a user