From d483143d47145210a810e37b5f31868a7a1a28f2 Mon Sep 17 00:00:00 2001 From: David Halter Date: Tue, 3 Sep 2013 22:41:56 +0430 Subject: [PATCH] fix a very annoying caching problem --- jedi/evaluate_representation.py | 2 +- jedi/helpers.py | 5 +++++ jedi/parsing.py | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index 00962451..3d71cc05 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -469,7 +469,7 @@ class Execution(Executable): if base.isinstance(Class): # There maybe executions of executions. - stmts = [Instance(base, self.var_args)] + return [Instance(base, self.var_args)] elif isinstance(base, Generator): return base.iter_content() else: diff --git a/jedi/helpers.py b/jedi/helpers.py index 9b54f0a3..fc651ef4 100644 --- a/jedi/helpers.py +++ b/jedi/helpers.py @@ -13,6 +13,11 @@ def fast_parent_copy(obj): new_elements = {} def recursion(obj): + if isinstance(obj, pr.Statement): + # Need to set _set_vars, otherwise the cache is not working + # correctly, don't know why. + obj.get_set_vars() + new_obj = copy.copy(obj) new_elements[obj] = new_obj diff --git a/jedi/parsing.py b/jedi/parsing.py index dca3eece..240f3c62 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -408,9 +408,6 @@ class Parser(object): stmt.parent = self.top_module self._check_user_stmt(stmt) - # TODO somehow this is important here. But it slows down Jedi, remove! - stmt.get_set_vars() - if tok in always_break + not_first_break: self._gen.push_last_back() return stmt, tok