From 76df356628be8d3c32fbe4ae19f4c062ec033827 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 15 Feb 2018 14:10:01 +0100 Subject: [PATCH] Relative imports should be working again even when used in more special occasions. Fixes #973 There are more fixes needed. Some things are just very unclean and might lead to further bugs. --- jedi/evaluate/imports.py | 2 +- test/completion/__init__.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/jedi/evaluate/imports.py b/jedi/evaluate/imports.py index 78a05e1f..b5e197c1 100644 --- a/jedi/evaluate/imports.py +++ b/jedi/evaluate/imports.py @@ -213,7 +213,7 @@ class Importer(object): if level: base = module_context.py__package__().split('.') - if base == ['']: + if base == [''] or base == ['__main__']: base = [] if level > len(base): path = module_context.py__file__() diff --git a/test/completion/__init__.py b/test/completion/__init__.py index 3c1a4bb3..dc4d7252 100644 --- a/test/completion/__init__.py +++ b/test/completion/__init__.py @@ -4,6 +4,5 @@ some_variable = 1 from . import imports -# TODO this is not correct -#? +#? int() imports.relative()