diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2023-05-04 12:02:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 12:02:50 +0300 |
commit | 49ed60b2cd57dee3ae0bd9667ebff1bbbb377ac5 (patch) | |
tree | b707c0a2de2c66c3c78d5bbbfe359ead0b2eb814 | |
parent | f1aa582026de6eaa09c30824ca4274c2efd09b7c (diff) | |
download | redis-py-49ed60b2cd57dee3ae0bd9667ebff1bbbb377ac5.tar.gz |
Fix protocol version checking (#2737)
-rw-r--r-- | redis/asyncio/client.py | 2 | ||||
-rwxr-xr-x | redis/client.py | 2 | ||||
-rw-r--r-- | tests/conftest.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index 5ef1f32..2cd2dad 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -255,7 +255,7 @@ class Redis( self.response_callbacks = CaseInsensitiveDict(self.__class__.RESPONSE_CALLBACKS) - if self.connection_pool.connection_kwargs.get("protocol") == "3": + if self.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: self.response_callbacks.update(self.__class__.RESP3_RESPONSE_CALLBACKS) # If using a single connection client, we need to lock creation-of and use-of diff --git a/redis/client.py b/redis/client.py index 565f133..c303dbd 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1109,7 +1109,7 @@ class Redis(AbstractRedis, RedisModuleCommands, CoreCommands, SentinelCommands): self.response_callbacks = CaseInsensitiveDict(self.__class__.RESPONSE_CALLBACKS) - if self.connection_pool.connection_kwargs.get("protocol") == "3": + if self.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: self.response_callbacks.update(self.__class__.RESP3_RESPONSE_CALLBACKS) def __repr__(self): diff --git a/tests/conftest.py b/tests/conftest.py index 035dbc8..c471f3d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -479,4 +479,4 @@ def is_resp2_connection(r): protocol = r.connection_pool.connection_kwargs.get("protocol") elif isinstance(r, redis.RedisCluster): protocol = r.nodes_manager.connection_kwargs.get("protocol") - return protocol == "2" or protocol is None + return protocol in ["2", 2, None] |