mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-21 01:58:27 +08:00
Avoid import recursions in other ways
This commit is contained in:
@@ -88,18 +88,6 @@ class NameFinder(object):
|
||||
for filter in filters:
|
||||
names = filter.get(self._string_name)
|
||||
if names:
|
||||
if len(names) == 1:
|
||||
n, = names
|
||||
if isinstance(n, TreeNameDefinition):
|
||||
# Something somewhere went terribly wrong. This
|
||||
# typically happens when using goto on an import in an
|
||||
# __init__ file. I think we need a better solution, but
|
||||
# it's kind of hard, because for Jedi it's not clear
|
||||
# that that name has not been defined, yet.
|
||||
if n.tree_name == self._name:
|
||||
def_ = self._name.get_definition()
|
||||
if def_ is not None and def_.type == 'import_from':
|
||||
continue
|
||||
break
|
||||
|
||||
debug.dbg('finder.filter_name %s in (%s): %s@%s',
|
||||
|
||||
@@ -95,7 +95,8 @@ def goto_import(context, tree_name):
|
||||
analysis_errors=False
|
||||
) for c in values
|
||||
])
|
||||
if names:
|
||||
# Avoid recursion on the same names.
|
||||
if names and not any(n.tree_name is tree_name for n in names):
|
||||
return names
|
||||
|
||||
path = import_path + (from_import_name,)
|
||||
|
||||
Reference in New Issue
Block a user