8000 refactor: use `is` instead of `==` (#560) · mgorny/python-betterproto@e98c478 · GitHub 65EF
[go: up one dir, main page]

Skip to content

Commit e98c478

Browse files
authored
refactor: use is instead of == (danielgtaylor#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.
1 parent dbd3192 commit e98c478

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/betterproto/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def __post_init__(self) -> None:
749749
group_current.setdefault(meta.group)
750750

751751
value = self.__raw_get(field_name)
752-
if value != PLACEHOLDER and not (meta.optional and value is None):
752+
if value is not PLACEHOLDER and not (meta.optional and value is None):
753753
# Found a non-sentinel value
754754
all_sentinel = False
755755

0 commit comments

Comments
 (0)
0