diff --git a/third_party/protobuf/protobuf.patch b/third_party/protobuf/protobuf.patch index 9d928ba175f330..cd948b7d62b81f 100644 --- a/third_party/protobuf/protobuf.patch +++ b/third_party/protobuf/protobuf.patch @@ -138,4 +138,32 @@ index 162531226..e93ec4809 100644 + return result; } - // If the calling code is not a _pb2.py file, raise AttributeError. \ No newline at end of file + // If the calling code is not a _pb2.py file, raise AttributeError. +diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py +index a6d8bcf64..24da4cac5 100644 +--- a/python/google/protobuf/text_format.py ++++ b/python/google/protobuf/text_format.py +@@ -470,9 +470,7 @@ class _Printer(object): + entry_submsg = value.GetEntryClass()(key=key, value=value[key]) + self.PrintField(field, entry_submsg) + elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED: +- if (self.use_short_repeated_primitives +- and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE +- and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_STRING): ++ if self.use_short_repeated_primitives: + self._PrintShortRepeatedPrimitivesValue(field, value) + else: + for element in value: +diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h +index 287d58f..c243e4a 100644 +--- a/src/google/protobuf/map_field.h ++++ b/src/google/protobuf/map_field.h +@@ -348,7 +348,7 @@ class PROTOBUF_EXPORT MapFieldBase { + : arena_(arena), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {} + + protected: +- ~MapFieldBase() { // "protected" stops users from deleting a `MapFieldBase *` ++ virtual ~MapFieldBase() { // "protected" stops users from deleting a `MapFieldBase *` + GOOGLE_DCHECK(repeated_field_ == nullptr); + } + void Destruct();