diff options
author | Ruben Vorderman <r.h.p.vorderman@lumc.nl> | 2021-09-02 17:02:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-02 17:02:59 +0200 |
commit | ea23e7820f02840368569db8082bd0ca4d59b62a (patch) | |
tree | 44dcdd66cf7335a31a837d7e84a857e5c677e2b3 /Modules/zlibmodule.c | |
parent | a7ef15aae8608560bffeeaba412c10e52cab07dd (diff) | |
download | cpython-git-ea23e7820f02840368569db8082bd0ca4d59b62a.tar.gz |
bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 3efb24a679..27a6d9a936 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -310,13 +310,15 @@ zlib.compress / level: int(c_default="Z_DEFAULT_COMPRESSION") = Z_DEFAULT_COMPRESSION Compression level, in 0-9 or -1. + wbits: int(c_default="MAX_WBITS") = MAX_WBITS + The window buffer size and container format. Returns a bytes object containing compressed data. [clinic start generated code]*/ static PyObject * -zlib_compress_impl(PyObject *module, Py_buffer *data, int level) -/*[clinic end generated code: output=d80906d73f6294c8 input=638d54b6315dbed3]*/ +zlib_compress_impl(PyObject *module, Py_buffer *data, int level, int wbits) +/*[clinic end generated code: output=46bd152fadd66df2 input=c4d06ee5782a7e3f]*/ { PyObject *RetVal; int flush; @@ -336,7 +338,8 @@ zlib_compress_impl(PyObject *module, Py_buffer *data, int level) zst.zalloc = PyZlib_Malloc; zst.zfree = PyZlib_Free; zst.next_in = ibuf; - int err = deflateInit(&zst, level); + int err = deflateInit2(&zst, level, DEFLATED, wbits, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY); switch (err) { case Z_OK: |