diff --git a/jedi/helpers.py b/jedi/helpers.py index 788f4f65..9a59333b 100644 --- a/jedi/helpers.py +++ b/jedi/helpers.py @@ -36,7 +36,10 @@ class RecursionDecorator(object): return False def pop_stmt(self): - self.current = self.current.parent + if self.current is not None: + # I don't know how current can be None, but sometimes it happens + # with Python3. + self.current = self.current.parent def _check_recursion(self): test = self.current diff --git a/jedi/imports.py b/jedi/imports.py index 7c9a31d9..b3391080 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -141,6 +141,7 @@ class ImportPath(object): scope, rest = self._follow_file_system() except ModuleNotFound: debug.warning('Module not found: ' + str(self.import_stmt)) + evaluate.follow_statement.pop_stmt() return [] scopes = [scope] diff --git a/test/regression.py b/test/regression.py index 88725732..71f45199 100755 --- a/test/regression.py +++ b/test/regression.py @@ -10,6 +10,7 @@ sys.path.append('.') from _compatibility import is_py25 import api + #api.set_debug_function(api.debug.print_to_stdout)