From 60ee6c607a95c9192d836e7f01aa928b83390ef7 Mon Sep 17 00:00:00 2001 From: Laurens Van Houtven <_@lvh.cc> Date: Sun, 23 Jun 2013 22:43:21 +0200 Subject: [PATCH] Don't throw away path optimization for modules with explicit absolute import --- jedi/imports.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jedi/imports.py b/jedi/imports.py index aa055795..d55d39e6 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -252,10 +252,13 @@ class ImportPath(pr.Base): return importing - parent = self.import_stmt.get_parent_until() - if self.file_path and not parent.explicit_absolute_import: + if self.file_path: sys_path_mod = list(self.sys_path_with_modifications()) - sys_path_mod.insert(0, self.file_path) + module = self.import_stmt.get_parent_until() + if not module.explicit_absolute_import: + # If the module explicitly asks for absolute imports, + # there's probably a bogus local one. + sys_path_mod.insert(0, self.file_path) else: sys_path_mod = list(modules.get_sys_path())