Fix is_set for optional proto3 fields
This commit is contained in:
committed by
GitHub
parent
6f7d706a8e
commit
3ca092a724
@@ -1319,7 +1319,12 @@ class Message(ABC):
|
||||
:class:`bool`
|
||||
`True` if field has been set, otherwise `False`.
|
||||
"""
|
||||
return self.__raw_get(name) is not PLACEHOLDER
|
||||
default = (
|
||||
PLACEHOLDER
|
||||
if not self._betterproto.meta_by_field_name[name].optional
|
||||
else None
|
||||
)
|
||||
return self.__raw_get(name) is not default
|
||||
|
||||
|
||||
def serialized_on_wire(message: Message) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user