diff --git a/jedi/dynamic.py b/jedi/dynamic.py index 7f6fcf0c..69457fa3 100644 --- a/jedi/dynamic.py +++ b/jedi/dynamic.py @@ -194,7 +194,6 @@ def search_params(param): first, last = call_path[:i], call_path[i+1:] if not last and not call_path.index(func_name) != i: continue - #print first, second, func scopes = [scope] if first: scopes = evaluate.follow_call_path(iter(first), scope, pos) @@ -203,10 +202,12 @@ def search_params(param): s = evaluate.find_name(scope, func_name, position=pos, search_global=not first, resolve_decorator=False) - #print s, pos, compare, func.parent - comparisons = [getattr(escope, 'base_func', None) or escope.base - for escope in s] - if compare in comparisons: + + c = [getattr(escope, 'base_func', None) or escope.base + for escope in s + if escope.isinstance(er.Function, er.Class) + ] + if compare in c: # only if we have the correct function we execute # it, otherwise just ignore it. evaluate.follow_paths(iter(last), s, scope) diff --git a/test/completion/dynamic.py b/test/completion/dynamic.py index e1be4017..50a4ea9d 100644 --- a/test/completion/dynamic.py +++ b/test/completion/dynamic.py @@ -63,6 +63,11 @@ def func(c=1): func(1.0) +# Needs to be here, because in this case func is an import -> shouldn't lead to +# exceptions. +import sys as func +func.sys + # ----------------- # classes # -----------------