Skip to content

Commit

Permalink
Use is with PLACEHOLDER instead of equality test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
atomicmac committed Feb 29, 2024
1 parent 5666393 commit d1d858f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/betterproto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d1d858f

Please sign in to comment.