@@ -138,4 +138,32 @@ index 162531226..e93ec4809 100644
138138+ return result;
139139 }
140140
141- // If the calling code is not a _pb2.py file, raise AttributeError.
141+ // If the calling code is not a _pb2.py file, raise AttributeError.
142+ diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py
143+ index a6d8bcf64..24da4cac5 100644
144+ --- a/python/google/protobuf/text_format.py
145+ +++ b/python/google/protobuf/text_format.py
146+ @@ -470,9 +470,7 @@ class _Printer(object):
147+ entry_submsg = value.GetEntryClass()(key=key, value=value[key])
148+ self.PrintField(field, entry_submsg)
149+ elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
150+ - if (self.use_short_repeated_primitives
151+ - and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE
152+ - and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_STRING):
153+ + if self.use_short_repeated_primitives:
154+ self._PrintShortRepeatedPrimitivesValue(field, value)
155+ else:
156+ for element in value:
157+ diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h
158+ index 287d58f..c243e4a 100644
159+ --- a/src/google/protobuf/map_field.h
160+ +++ b/src/google/protobuf/map_field.h
161+ @@ -348,7 +348,7 @@ class PROTOBUF_EXPORT MapFieldBase {
162+ : arena_(arena), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {}
163+
164+ protected:
165+ - ~MapFieldBase() { // "protected" stops users from deleting a `MapFieldBase *`
166+ + virtual ~MapFieldBase() { // "protected" stops users from deleting a `MapFieldBase *`
167+ GOOGLE_DCHECK(repeated_field_ == nullptr);
168+ }
169+ void Destruct();
0 commit comments