Skip to content

Commit f517287

Browse files
jmcbaileydvora-h
andauthored
Fix issue with pack_commands returning an empty byte sequence (#2416)
Co-authored-by: dvora-h <[email protected]>
1 parent fcd8f98 commit f517287

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
@@ -925,7 +925,8 @@ def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> List[bytes]
925925
or chunklen > buffer_cutoff
926926
or isinstance(chunk, memoryview)
927927
):
928-
output.append(SYM_EMPTY.join(pieces))
928+
if pieces:
929+
output.append(SYM_EMPTY.join(pieces))
929930
buffer_length = 0
930931
pieces = []
931932

redis/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,8 @@ def pack_commands(self, commands):
976976
or chunklen > buffer_cutoff
977977
or isinstance(chunk, memoryview)
978978
):
979-
output.append(SYM_EMPTY.join(pieces))
979+
if pieces:
980+
output.append(SYM_EMPTY.join(pieces))
980981
buffer_length = 0
981982
pieces = []
982983

0 commit comments

Comments
 (0)