jedi issues now warnings instead of errors for AttributeErrors that happen in instances with __getattr__/__getattribute__ methods

This commit is contained in:
Dave Halter
2014-06-26 12:21:19 +02:00
parent 7e0edc4776
commit a936cea987
2 changed files with 23 additions and 11 deletions
+4 -7
View File
@@ -50,17 +50,14 @@ class NameFinder(object):
and not (isinstance(self.name_str, pr.NamePart)
and isinstance(self.name_str.parent.parent, pr.Param)):
if not isinstance(self.name_str, (str, unicode)): # TODO Remove?
err_type = 'name-error' if search_global else 'attribute-error'
if err_type == 'name-error':
if search_global:
message = ("NameError: name '%s' is not defined."
% self.name_str)
analysis.add(self._evaluator, 'name-error', self.name_str,
message)
else:
message = ('AttributeError: %s has no attribute %s.'
% (self._last_filter_name_scope, self.name_str))
payload = self.name_str
analysis.add_attribute_error(self._evaluator,
self.name_str, message,
self.scope)
self.scope, self.name_str)
debug.dbg('finder._names_to_types: %s -> %s', names, types)
return self._resolve_descriptors(types)