parent
3514991133
commit
8b5dd6c1f8
@ -909,7 +909,7 @@ class Message(ABC):
|
|||||||
# Note that proto3 field presence/optional fields are put in a
|
# Note that proto3 field presence/optional fields are put in a
|
||||||
# synthetic single-item oneof by protoc, which helps us ensure we
|
# synthetic single-item oneof by protoc, which helps us ensure we
|
||||||
# send the value even if the value is the default zero value.
|
# send the value even if the value is the default zero value.
|
||||||
selected_in_group = bool(meta.group)
|
selected_in_group = bool(meta.group) or meta.optional
|
||||||
|
|
||||||
# Empty messages can still be sent on the wire if they were
|
# Empty messages can still be sent on the wire if they were
|
||||||
# set (or received empty).
|
# set (or received empty).
|
||||||
|
@ -385,7 +385,10 @@ def is_oneof(proto_field_obj: FieldDescriptorProto) -> bool:
|
|||||||
us to tell whether it was set, via the which_one_of interface.
|
us to tell whether it was set, via the which_one_of interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return which_one_of(proto_field_obj, "oneof_index")[0] == "oneof_index"
|
return (
|
||||||
|
not proto_field_obj.proto3_optional
|
||||||
|
and which_one_of(proto_field_obj, "oneof_index")[0] == "oneof_index"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user