From e98c47861d5607f4cadab0bcec5016ba2093b632 Mon Sep 17 00:00:00 2001 From: atomicmac <156139337+atomicmac@users.noreply.github.com> Date: Sat, 23 Mar 2024 14:43:56 -0700 Subject: [PATCH] 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. --- 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 da6893d..c16e2cd 100644 --- a/src/betterproto/__init__.py +++ b/src/betterproto/__init__.py @@ -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