Skip to content

Commit ab55226

Browse files
committed
Fix flush
1 parent 89a411c commit ab55226

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/isal/isal_zlib.pyx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ cdef class Compress:
469469
return b""
470470
elif mode == zlib.Z_FINISH:
471471
self.stream.flush = FULL_FLUSH
472+
self.stream.end_of_stream = 1
472473
elif mode == zlib.Z_FULL_FLUSH:
473474
self.stream.flush = FULL_FLUSH
474475
elif mode == zlib.Z_SYNC_FLUSH:
@@ -492,14 +493,8 @@ cdef class Compress:
492493
# the data is appended to a list.
493494
# TODO: Improve this with the buffer protocol.
494495
out.append(self.obuf[:self.obuflen - self.stream.avail_out])
495-
496496
if self.stream.avail_out != 0: # All input is processed and therefore all output flushed.
497-
if self.stream.internal_state.state != ZSTATE_END and mode == zlib.Z_FINISH:
498-
# If mode ==zlib.Z_FINISH we do one more round to finish the stream.
499-
self.stream.end_of_stream = 1
500-
continue
501-
else:
502-
break
497+
break
503498
if self.stream.avail_in != 0:
504499
raise AssertionError("There should be no available input after flushing.")
505500
return b"".join(out)

0 commit comments

Comments
 (0)