From 6a586a6810e43e24080478c027de22fac3c8abf6 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Fri, 8 May 2020 12:32:21 -0600 Subject: [PATCH] Fix '"is" with a literal' syntax warnings As of Python 3.8, "is" with a literal is a syntax warning and may become an error in the future. Kazoo ran afoul of this in a few places however. --- kazoo/protocol/serialization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kazoo/protocol/serialization.py b/kazoo/protocol/serialization.py index 14ad71a2..80fa4d10 100644 --- a/kazoo/protocol/serialization.py +++ b/kazoo/protocol/serialization.py @@ -111,7 +111,7 @@ def deserialize(cls, bytes, offset): password, offset = read_buffer(bytes, offset) try: - read_only = bool_struct.unpack_from(bytes, offset)[0] is 1 + read_only = bool_struct.unpack_from(bytes, offset)[0] == 1 offset += bool_struct.size except struct.error: read_only = False @@ -446,4 +446,4 @@ def serialize(self): def deserialize(cls, bytes, offset): t, done, err = multiheader_struct.unpack_from(bytes, offset) offset += multiheader_struct.size - return cls(t, done is 1, err), offset + return cls(t, done == 1, err), offset