File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -540,6 +540,14 @@ cdef class Decompress:
540
540
if self .obuf is not NULL :
541
541
PyMem_Free(self .obuf)
542
542
543
+ cdef bytes consume_read_in(self ):
544
+ read_in_length = self .stream.read_in_length // 8
545
+ if read_in_length == 0 :
546
+ return b" "
547
+ read_in = self .stream.read_in
548
+ result = read_in.to_bytes(8 , " little" )[:read_in_length]
549
+ return read_in.to_bytes(8 , " little" )[:read_in_length]
550
+
543
551
cdef save_unconsumed_input(self , Py_buffer * data):
544
552
cdef Py_ssize_t old_size, new_size, left_size
545
553
cdef bytes new_data
@@ -551,7 +559,7 @@ cdef class Decompress:
551
559
if left_size > (PY_SSIZE_T_MAX - old_size):
552
560
raise MemoryError ()
553
561
new_data = PyBytes_FromStringAndSize(< char * > self .stream.next_in, left_size)
554
- self .unused_data += new_data
562
+ self .unused_data = self .consume_read_in() + new_data
555
563
if self .stream.avail_in > 0 or self .unconsumed_tail:
556
564
left_size = < unsigned char * > data.buf + data.len - self .stream.next_in
557
565
new_data = PyBytes_FromStringAndSize(< char * > self .stream.next_in, left_size)
You can’t perform that action at this time.
0 commit comments