diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 610a5539..1e8a02ab 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -8,7 +8,6 @@ search functions `get_names_for_scope` and `get_scopes_for_name`. At the end there are the `follow_` functions, which evaluate a statement, or parts of a statement. -TODO super() TODO nonlocal statement, needed or can be ignored? (py3k) """ from _compatibility import next, property, hasattr, is_py3k, use_metaclass, \ @@ -842,7 +841,7 @@ class Array(use_metaclass(cache.CachedMetaClass, parsing.Base)): def __getattr__(self, name): if name not in ['type', 'start_pos', 'get_only_subelement']: - raise AttributeError('Strange access: %s.' % name) + raise AttributeError('Strange access on %s: %s.' % (self, name)) return getattr(self._array, name) def __repr__(self): diff --git a/jedi/helpers.py b/jedi/helpers.py index 154d3879..2c057ef8 100644 --- a/jedi/helpers.py +++ b/jedi/helpers.py @@ -218,7 +218,7 @@ def scan_array_for_pos(arr, pos, overwrite_after=False): call = None for s in sub: if isinstance(s, parsing.Array): - new = scan_array_for_pos(s, pos) + new = scan_array_for_pos(s, pos, overwrite_after) if new[0] is not None: call, index, stop = new if stop: @@ -234,7 +234,7 @@ def scan_array_for_pos(arr, pos, overwrite_after=False): if s.execution.start_pos < pos and \ (None in end or pos < end): c, index, stop = scan_array_for_pos( - s.execution, pos) + s.execution, pos, overwrite_after) if stop: return c, index, stop diff --git a/jedi/modules.py b/jedi/modules.py index 4a0b0c90..0a00b72d 100644 --- a/jedi/modules.py +++ b/jedi/modules.py @@ -196,6 +196,8 @@ class ModuleWithCursor(Module): def get_line(self, line_nr): if not self._line_cache: self._line_cache = self.source.splitlines() + if not self.source: # ''.splitlines() == [] + self._line_cache = [self.source] if line_nr == 0: # This is a fix for the zeroth line. We need a newline there, for