From 536c1881920c620ebf97920a71544be295f90920 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 3 Dec 2014 12:59:43 +0100 Subject: [PATCH] Change get_self_vars. Now using py__mro__ to avoid recursions. --- jedi/evaluate/representation.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index ab9745a4..dfee180b 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -147,7 +147,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)): return None @memoize_default([]) - def get_self_attributes(self): + def get_self_attributes(self, add_mro=True): names = [] # This loop adds the names of the self object, copies them and removes # the self. @@ -177,10 +177,11 @@ class Instance(use_metaclass(CachedMetaClass, Executed)): if name.is_definition(): names.append(get_instance_el(self._evaluator, self, name)) - for s in self.base.py__bases__(self._evaluator): - if not isinstance(s, compiled.CompiledObject): - for inst in self._evaluator.execute(s): - names += inst.get_self_attributes() + if add_mro: + for s in self.base.py__mro__(self._evaluator)[1:]: + if not isinstance(s, compiled.CompiledObject): + for inst in self._evaluator.execute(s): + names += inst.get_self_attributes(add_mro=False) return names def get_subscope_by_name(self, name):