mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-25 17:58:35 +08:00
Change get_self_vars. Now using py__mro__ to avoid recursions.
This commit is contained in:
@@ -147,7 +147,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@memoize_default([])
|
@memoize_default([])
|
||||||
def get_self_attributes(self):
|
def get_self_attributes(self, add_mro=True):
|
||||||
names = []
|
names = []
|
||||||
# This loop adds the names of the self object, copies them and removes
|
# This loop adds the names of the self object, copies them and removes
|
||||||
# the self.
|
# the self.
|
||||||
@@ -177,10 +177,11 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
if name.is_definition():
|
if name.is_definition():
|
||||||
names.append(get_instance_el(self._evaluator, self, name))
|
names.append(get_instance_el(self._evaluator, self, name))
|
||||||
|
|
||||||
for s in self.base.py__bases__(self._evaluator):
|
if add_mro:
|
||||||
if not isinstance(s, compiled.CompiledObject):
|
for s in self.base.py__mro__(self._evaluator)[1:]:
|
||||||
for inst in self._evaluator.execute(s):
|
if not isinstance(s, compiled.CompiledObject):
|
||||||
names += inst.get_self_attributes()
|
for inst in self._evaluator.execute(s):
|
||||||
|
names += inst.get_self_attributes(add_mro=False)
|
||||||
return names
|
return names
|
||||||
|
|
||||||
def get_subscope_by_name(self, name):
|
def get_subscope_by_name(self, name):
|
||||||
|
|||||||
Reference in New Issue
Block a user