Skip to content

Commit bc3bde1

Browse files
committed
Fix parsing resp3 dicts
1 parent 787d731 commit bc3bde1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

redis/_parsers/resp3.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def _read_response(self, disable_decoding=False, push_request=False):
9898
elif byte == b"%":
9999
# we use this approach and not dict comprehension here
100100
# because this dict comprehension fails in python 3.7
101+
# (evaluation order of key:val is _undefined_ in Python)
101102
resp_dict = {}
102103
for _ in range(int(response)):
103104
key = self._read_response(disable_decoding=disable_decoding)
@@ -225,12 +226,16 @@ async def _read_response(
225226
pass
226227
# map response
227228
elif byte == b"%":
228-
response = {
229-
(await self._read_response(disable_decoding=disable_decoding)): (
230-
await self._read_response(disable_decoding=disable_decoding)
229+
# we use this approach and not dict comprehension here
230+
# because this dict comprehension fails in python 3.7
231+
# (evaluation order of key:val is _undefined_ in Python)
232+
resp_dict = {}
233+
for _ in range(int(response)):
234+
key = await self._read_response(disable_decoding=disable_decoding)
235+
resp_dict[key] = await self._read_response(
236+
disable_decoding=disable_decoding, push_request=push_request
231237
)
232-
for _ in range(int(response))
233-
}
238+
response = resp_dict
234239
# push response
235240
elif byte == b">":
236241
response = [

redis/asyncio/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ async def read_response(
493493
and self.protocol in ["3", 3]
494494
and not HIREDIS_AVAILABLE
495495
):
496+
read_timeout = None
496497
async with async_timeout(read_timeout):
497498
response = await self._parser.read_response(
498499
disable_decoding=disable_decoding, push_request=push_request

0 commit comments

Comments
 (0)