mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-19 23:09:43 +08:00
Fix an issue with recursion for arrays
This commit is contained in:
@@ -264,8 +264,10 @@ class TreeInstance(AbstractInstanceContext):
|
|||||||
def name(self):
|
def name(self):
|
||||||
return filters.ContextName(self, self.class_context.name.tree_name)
|
return filters.ContextName(self, self.class_context.name.tree_name)
|
||||||
|
|
||||||
@evaluator_method_cache()
|
# This can recurse, if the initialization of the class includes a reference
|
||||||
def get_annotated_class_object(self):
|
# to itself.
|
||||||
|
@evaluator_method_cache(default=None)
|
||||||
|
def _get_annotated_class_object(self):
|
||||||
from jedi.evaluate import pep0484
|
from jedi.evaluate import pep0484
|
||||||
|
|
||||||
for func in self._get_annotation_init_functions():
|
for func in self._get_annotation_init_functions():
|
||||||
@@ -287,7 +289,9 @@ class TreeInstance(AbstractInstanceContext):
|
|||||||
)
|
)
|
||||||
debug.dbg('Inferred instance context as %s', defined, color='BLUE')
|
debug.dbg('Inferred instance context as %s', defined, color='BLUE')
|
||||||
return defined
|
return defined
|
||||||
return self.class_context
|
|
||||||
|
def get_annotated_class_object(self):
|
||||||
|
return self._get_annotated_class_object() or self.class_context
|
||||||
|
|
||||||
def _get_annotation_init_functions(self):
|
def _get_annotation_init_functions(self):
|
||||||
for init in self.class_context.py__getattribute__('__init__'):
|
for init in self.class_context.py__getattribute__('__init__'):
|
||||||
|
|||||||
Reference in New Issue
Block a user