This is just part of an effort at locking down (and understand well) how map entries are serialized into textproto when they have empty fields. Right now the C++ behaviour for DynamicMessages is that for implicit-presence (i.e. "proto3") fields, the empty MapEntry fields are not serialized even if explicitly set. For example, `value: ""` would not show up in textproto serialization for proto3 MapEntry messages. This contrasts with C++ map reflection behaviour, because C++ MapEntry messages are always generated with hasbits (even if they are declared in a proto3 file and have implicit presence according to their descriptors). For this Python test, the DynamicMessage fallback path was triggered because the implementation of the C++ proto was not found. When python is lacking in implementation, it calls DynamicMessage which respects field presence, even for map entries. If the corresponding `map_unittest_cc_proto` is linked, this test actually fails, because the C++ MapEntry implementation, which is always generated with hasbits even for implicit presence, is used. PiperOrigin-RevId: 681944020pull/18606/head
parent
fa858b82d2
commit
d4a32bbc87
1 changed files with 67 additions and 0 deletions
Loading…
Reference in new issue