mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-26 06:07:16 +08:00
Fix Python 2 old-school relative imports
This commit is contained in:
@@ -265,6 +265,11 @@ class Importer(object):
|
|||||||
sys_path_mod = self._evaluator.get_sys_path() \
|
sys_path_mod = self._evaluator.get_sys_path() \
|
||||||
+ sys_path.check_sys_path_modifications(self.module_context)
|
+ sys_path.check_sys_path_modifications(self.module_context)
|
||||||
|
|
||||||
|
if self.import_path and self.file_path is not None \
|
||||||
|
and self._evaluator.environment.version_info.major == 2:
|
||||||
|
# Python2 uses an old strange way of importing relative imports.
|
||||||
|
sys_path_mod.append(force_unicode(os.path.dirname(self.file_path)))
|
||||||
|
|
||||||
return sys_path_mod
|
return sys_path_mod
|
||||||
|
|
||||||
def follow(self):
|
def follow(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user