Skip to content

Commit

Permalink
Fix issue with pack_commands returning an empty byte sequence (redi…
Browse files Browse the repository at this point in the history
…s#2416)

Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
  • Loading branch information
jmcbailey and dvora-h committed Feb 7, 2023
1 parent fcd8f98 commit f517287
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,8 @@ def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> List[bytes]
or chunklen > buffer_cutoff
or isinstance(chunk, memoryview)
):
output.append(SYM_EMPTY.join(pieces))
if pieces:
output.append(SYM_EMPTY.join(pieces))
buffer_length = 0
pieces = []

Expand Down
3 changes: 2 additions & 1 deletion redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,8 @@ def pack_commands(self, commands):
or chunklen > buffer_cutoff
or isinstance(chunk, memoryview)
):
output.append(SYM_EMPTY.join(pieces))
if pieces:
output.append(SYM_EMPTY.join(pieces))
buffer_length = 0
pieces = []

Expand Down

0 comments on commit f517287

Please sign in to comment.