diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index 5ef1f3292e..2cd2daddcc 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -255,7 +255,7 @@ def __init__( 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 71048f548f..288e844a62 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1088,7 +1088,7 @@ def __init__( 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 035dbc85cf..c471f3d837 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]