Skip to content

Commit

Permalink
Fix protocol version checking (#2737)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h authored May 4, 2023
1 parent f1aa582 commit 49ed60b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,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):
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit 49ed60b

Please sign in to comment.