Skip to content

Commit 5913c22

Browse files
committed
fixing protobuf warning #12
1 parent bd43820 commit 5913c22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/xml/protobuf2xml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def msg2xml(desc, cont, out, depth=1):
7272
# print(depth, cont)
7373
for attr, value in cont.ListFields():
7474
if attr.type == google.protobuf.descriptor.FieldDescriptor.TYPE_MESSAGE:
75-
if attr.label == google.protobuf.descriptor.FieldDescriptor.LABEL_REPEATED:
75+
if attr.is_repeated if hasattr(attr, 'is_repeated') else attr.label == google.protobuf.descriptor.FieldDescriptor.LABEL_REPEATED:
7676
haveChildren = True
7777
for item in value:
7878
msg2xml(attr, item, out, depth + 1)
@@ -101,7 +101,7 @@ def writeXml(root, module, options):
101101
obj.ParseFromString(read_n(inputf, length))
102102
for attr, value in obj.ListFields():
103103
if attr.type == google.protobuf.descriptor.FieldDescriptor.TYPE_MESSAGE:
104-
if attr.label == google.protobuf.descriptor.FieldDescriptor.LABEL_REPEATED:
104+
if attr.is_repeated if hasattr(attr, 'is_repeated') else attr.label == google.protobuf.descriptor.FieldDescriptor.LABEL_REPEATED:
105105
for item in value:
106106
msg2xml(attr, item, outputf)
107107
elif first:

0 commit comments

Comments
 (0)