Skip to content

Commit c9dfad3

Browse files
committed
Fix issue with pack_commands returning an empty byte sequence
1 parent 12f95de commit c9dfad3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

redis/asyncio/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,8 @@ def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> List[bytes]
975975
or chunklen > buffer_cutoff
976976
or isinstance(chunk, memoryview)
977977
):
978-
output.append(SYM_EMPTY.join(pieces))
978+
if pieces:
979+
output.append(SYM_EMPTY.join(pieces))
979980
buffer_length = 0
980981
pieces = []
981982

redis/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ def pack_commands(self, commands):
875875
or chunklen > buffer_cutoff
876876
or isinstance(chunk, memoryview)
877877
):
878-
output.append(SYM_EMPTY.join(pieces))
878+
if pieces:
879+
output.append(SYM_EMPTY.join(pieces))
879880
buffer_length = 0
880881
pieces = []
881882

0 commit comments

Comments
 (0)