We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 133a332 commit a61a3c8Copy full SHA for a61a3c8
packages/proto-plus/proto/marshal/collections/repeated.py
@@ -104,7 +104,13 @@ def _pb_type(self):
104
if len(self.pb) > 0:
105
return type(self.pb[0])
106
107
- # We have no members in the list.
+ # We have no members in the list, so we get the type from the attributes.
108
+ if hasattr(self.pb, "_message_descriptor") and hasattr(
109
+ self.pb._message_descriptor, "_concrete_class"
110
+ ):
111
+ return self.pb._message_descriptor._concrete_class
112
+
113
+ # Fallback logic in case attributes are not available
114
# In order to get the type, we create a throw-away copy and add a
115
# blank member to it.
116
canary = copy.deepcopy(self.pb).add()
0 commit comments