Merge pull request #33384 from abhaikollara:patch

PiperOrigin-RevId: 274858684
Change-Id: I31dd725d097ca32eec89573857fcef07f244865b
This commit is contained in:
TensorFlower Gardener 2019-10-15 13:24:18 -07:00
commit fc9315df4d

View File

@ -79,8 +79,8 @@ class AttributeAccessSymbol(Symbol):
if (is_undefined(parent_value) or
getattr(parent_value, self.attr_name, None) is None):
return Undefined(self.name)
else:
return parent_value.__getattribute__(self.attr_name)
return parent_value.__getattribute__(self.attr_name)
class SubscriptSymbol(Symbol):
@ -106,10 +106,10 @@ class SubscriptSymbol(Symbol):
index_value = self.index_symbol.maybe_compute_value()
if is_undefined(parent_value) or is_undefined(index_value):
return Undefined(self.name)
else:
try:
return parent_value[index_value]
except (IndexError, KeyError, TypeError):
# Reify the lack of an object for the given index/key
# This allows us to define them later without regret
return Undefined(self.name)
try:
return parent_value[index_value]
except (IndexError, KeyError, TypeError):
# Reify the lack of an object for the given index/key
# This allows us to define them later without regret
return Undefined(self.name)