]> granicus.if.org Git - python/commit
Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX
authorMartin Panter <vadmium+py@gmail.com>
Fri, 20 Nov 2015 08:13:35 +0000 (08:13 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Fri, 20 Nov 2015 08:13:35 +0000 (08:13 +0000)
commite99e97762cc75ad94056275ddcae9c84d63a3412
treef16040197bf0122ce6aded03018b4ee6fee03679
parentd13cade3817cf452b7c98e9df96b15c6da68201a
Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX

The underlying zlib library stores sizes in “unsigned int”. The corresponding
Python parameters are all sizes of buffers filled in by zlib, so it is okay
to reduce higher values to the UINT_MAX internal cap. OverflowError is still
raised for sizes that do not fit in Py_ssize_t.

Sizes are now limited to Py_ssize_t rather than unsigned long, because Python
byte strings cannot be larger than Py_ssize_t. Previously this could result
in a SystemError on 32-bit platforms.

This resolves a regression in the gzip module when reading more than UINT_MAX
or LONG_MAX bytes in one call, introduced by revision 62723172412c.
Doc/howto/clinic.rst
Lib/test/support/__init__.py
Lib/test/test_gzip.py
Lib/test/test_zlib.py
Misc/NEWS
Modules/clinic/zlibmodule.c.h
Modules/zlibmodule.c