From 4df89f02720e7e9f86ef7fdfcb535f346588f57f Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 24 Nov 2012 02:57:32 +0100 Subject: [PATCH] cleanup and last fixes -> fixes #68 --- jedi/evaluate.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/jedi/evaluate.py b/jedi/evaluate.py index c20c5940..088e5db3 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -508,7 +508,6 @@ class Execution(Executable): # otherwise it would be a metaclass if len(self.var_args) == 1: objects = follow_call_list([self.var_args[0]]) - print 'LALA', objects, [o.base for o in objects if isinstance(o, Instance)] return [o.base for o in objects if isinstance(o, Instance)] if self.base.isinstance(Class): @@ -734,19 +733,22 @@ class Execution(Executable): @memoize_default() def _scope_copy(self, scope): - try: - """ Copies a scope (e.g. if) in an execution """ - # TODO This method uses different scopes than the subscopes property. - if scope == self.base or scope == self.base.base_func: - return self - else: + try: + """ Copies a scope (e.g. if) in an execution """ + # TODO method uses different scopes than the subscopes property. + + # just check the start_pos, sometimes it's difficult with closures + # to compare the scopes directly. + if scope.start_pos == self.start_pos: + return self + else: copied = helpers.fast_parent_copy(scope) #copied.parent = self._scope_copy(copied.parent()) copied.parent = weakref.ref(self._scope_copy(copied.parent())) #copied.parent = weakref.ref(self) faked_scopes.append(copied) return copied - except AttributeError: + except AttributeError: raise MultiLevelAttributeError(sys.exc_info())