File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -469,6 +469,7 @@ cdef class Compress:
469
469
return b" "
470
470
elif mode == zlib.Z_FINISH:
471
471
self .stream.flush = FULL_FLUSH
472
+ self .stream.end_of_stream = 1
472
473
elif mode == zlib.Z_FULL_FLUSH:
473
474
self .stream.flush = FULL_FLUSH
474
475
elif mode == zlib.Z_SYNC_FLUSH:
@@ -492,14 +493,8 @@ cdef class Compress:
492
493
# the data is appended to a list.
493
494
# TODO: Improve this with the buffer protocol.
494
495
out.append(self .obuf[:self .obuflen - self .stream.avail_out])
495
-
496
496
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
503
498
if self .stream.avail_in != 0 :
504
499
raise AssertionError (" There should be no available input after flushing." )
505
500
return b" " .join(out)
You can’t perform that action at this time.
0 commit comments