Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Apr 29, 2022
1 parent 896c140 commit 51ee0ad
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion proto/marshal/collections/repeated.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ def _pb_type(self):
return type(self.pb[0])

# We have no members in the list, so we get the type from the attributes.
return self.pb._message_descriptor._concrete_class
if hasattr(self.pb, "_message_descriptor") and hasattr(
self.pb._message_descriptor, "_concrete_class"
):
return self.pb._message_descriptor._concrete_class

# Fallback logic in case attributes are not available
# In order to get the type, we create a throw-away copy and add a
# blank member to it.
canary = copy.deepcopy(self.pb).add()
return type(canary)

def __eq__(self, other):
if super().__eq__(other):
Expand Down

0 comments on commit 51ee0ad

Please sign in to comment.