File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -206,24 +206,13 @@ class _IGzipReader(gzip._GzipReader):
206
206
def __init__ (self , fp ):
207
207
super ().__init__ (fp )
208
208
self ._decomp_factory = isal_zlib .decompressobj
209
- self ._decomp_args = dict (wbits = 64 + isal_zlib .MAX_WBITS )
210
- # Set wbits such that ISAL_GZIP_NO_HDR_VER is used. This means that
211
- # it does not read a header, and it verifies the trailer.
212
209
self ._decompressor = self ._decomp_factory (** self ._decomp_args )
213
210
214
211
def _add_read_data (self , data ):
215
- # isa-l verifies the trailer data, so no need to keep track of the crc.
216
- self ._stream_size = self ._stream_size + len (data )
217
-
218
- def _read_eof (self ):
219
- # Gzip files can be padded with zeroes and still have archives.
220
- # Consume all zero bytes and set the file position to the first
221
- # non-zero byte. See http://www.gzip.org/#faq8
222
- c = b"\x00 "
223
- while c == b"\x00 " :
224
- c = self ._fp .read (1 )
225
- if c :
226
- self ._fp .prepend (c )
212
+ # Use faster isal crc32 calculation and update the stream size in place
213
+ # compared to CPython gzip
214
+ self ._crc = isal_zlib .crc32 (data , self ._crc )
215
+ self ._stream_size += len (data )
227
216
228
217
229
218
# Plagiarized from gzip.py from python's stdlib.
You can’t perform that action at this time.
0 commit comments