Move error handling for py__getattribute__

This commit is contained in:
Dave Halter
2019-08-24 00:59:48 +02:00
parent bd24ee2ab3
commit ddb2ccb657
3 changed files with 24 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ just one.
"""
from functools import reduce
from operator import add
from parso.python.tree import ExprStmt, SyncCompFor, Name
from parso.python.tree import ExprStmt, SyncCompFor, Name, Param
from jedi import debug
from jedi._compatibility import zip_longest, unicode
@@ -81,6 +81,14 @@ class HelperValueMixin(object):
if not values:
n = name_or_str.value if isinstance(name_or_str, Name) else name_or_str
values = self.py__getattribute__alternatives(n)
if not names and analysis_errors and not values \
and not (isinstance(name_or_str, Name) and
isinstance(name_or_str.parent.parent, Param)):
if isinstance(name_or_str, Name):
from jedi.inference import analysis
analysis.add_attribute_error(
name_context, self, name_or_str)
return values
def goto(self, *args, **kwargs):