Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions redis/_parsers/resp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ def _read_response(self, disable_decoding=False, push_request=False):
pass
# map response
elif byte == b"%":
# we use this approach and not dict comprehension here
# because this dict comprehension fails in python 3.7
# We cannot use a dict-comprehension to parse stream.
# Evaluation order of key:val expression in dict comprehension only
# became defined to be left-right in version 3.8
resp_dict = {}
for _ in range(int(response)):
key = self._read_response(disable_decoding=disable_decoding)
Expand Down Expand Up @@ -225,12 +226,16 @@ async def _read_response(
pass
# map response
elif byte == b"%":
response = {
(await self._read_response(disable_decoding=disable_decoding)): (
await self._read_response(disable_decoding=disable_decoding)
# We cannot use a dict-comprehension to parse stream.
# Evaluation order of key:val expression in dict comprehension only
# became defined to be left-right in version 3.8
resp_dict = {}
for _ in range(int(response)):
key = await self._read_response(disable_decoding=disable_decoding)
resp_dict[key] = await self._read_response(
disable_decoding=disable_decoding, push_request=push_request
)
for _ in range(int(response))
}
response = resp_dict
# push response
elif byte == b">":
response = [
Expand Down