From d1d858f07278517d0a7bcbca3effc734cf37e79d Mon Sep 17 00:00:00 2001 From: atomicmac <156139337+atomicmac@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:22:30 -0800 Subject: [PATCH] Use is with PLACEHOLDER instead of equality test 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. --- src/betterproto/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/betterproto/__init__.py b/src/betterproto/__init__.py index da6893db7..c16e2cdd9 100644 --- a/src/betterproto/__init__.py +++ b/src/betterproto/__init__.py @@ -749,7 +749,7 @@ def __post_init__(self) -> None: 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