refactor: use is instead of == (#560)

PLACEHOLDER is a specific instance of an object, the test here should be "is not" instead of "!="
I am experimenting with adding ndarray support, and the equality test here causes problems.
This commit is contained in:
atomicmac 2024-03-23 14:43:56 -07:00 committed by GitHub
parent dbd31929d3
commit e98c47861d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -749,7 +749,7 @@ class Message(ABC):
group_current.setdefault(meta.group)
value = self.__raw_get(field_name)
if value != PLACEHOLDER and not (meta.optional and value is None):
if value is not PLACEHOLDER and not (meta.optional and value is None):
# Found a non-sentinel value
all_sentinel = False