gh-90839: Forward gzip.compress() compresslevel to zlib (gh-31215)

This commit is contained in:
Ilya Leoshkevich 2022-04-12 15:46:40 +02:00 committed by GitHub
parent e44f988b26
commit 943ca5e1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -587,7 +587,8 @@ def compress(data, compresslevel=_COMPRESS_LEVEL_BEST, *, mtime=None):
header = _create_simple_gzip_header(compresslevel, mtime)
trailer = struct.pack("<LL", zlib.crc32(data), (len(data) & 0xffffffff))
# Wbits=-15 creates a raw deflate block.
return header + zlib.compress(data, wbits=-15) + trailer
return (header + zlib.compress(data, level=compresslevel, wbits=-15) +
trailer)
def decompress(data):

View File

@ -0,0 +1 @@
Forward gzip.compress() compresslevel to zlib.