Skip to content

Commit 7ce513d

Browse files
authored
fix(connection): Ensure we have an initialized protocol in connection (#3981)
1 parent 8e3a5b2 commit 7ce513d

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

redis/asyncio/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(
248248
else:
249249
if p < 2 or p > 3:
250250
raise ConnectionError("protocol must be either 2 or 3")
251-
self.protocol = p
251+
self.protocol = p
252252

253253
def __del__(self, _warnings: Any = warnings):
254254
# For some reason, the individual streams don't get properly garbage

redis/connection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ def __init__(
884884
else:
885885
if p < 2 or p > 3:
886886
raise ConnectionError("protocol must be either 2 or 3")
887-
# p = DEFAULT_RESP_VERSION
888-
self.protocol = p
887+
self.protocol = p
889888
if self.protocol == 3 and parser_class == _RESP2Parser:
890889
# If the protocol is 3 but the parser is RESP2, change it to RESP3
891890
# This is needed because the parser might be set before the protocol

0 commit comments

Comments
 (0)