summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2022-04-12 13:46:40 (GMT)
committerGitHub <noreply@github.com>2022-04-12 13:46:40 (GMT)
commit943ca5e1d6b72830c530a72426cff094f155d010 (patch)
tree7c7e3f44bc38b82f8b22b218a4c0284fcaabf677 /Lib/gzip.py
parente44f988b26cffedc8fd74c0424ac1fada695688b (diff)
downloadcpython-943ca5e1d6b72830c530a72426cff094f155d010.zip
cpython-943ca5e1d6b72830c530a72426cff094f155d010.tar.gz
cpython-943ca5e1d6b72830c530a72426cff094f155d010.tar.bz2
gh-90839: Forward gzip.compress() compresslevel to zlib (gh-31215)
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 6773ea3..5b20e5b 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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):