FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX · python/devguide@c4a0b9c · GitHub

Repository navigation

Commit c4a0b9c

Browse files
authored andcommitted
Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX
GitHub-Issue-Link: python/cpython#69812 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.
1 parent 68c76ed commit c4a0b9c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎Doc/howto/clinic.rst‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,18 +1249,18 @@ Here's the simplest example of a custom converter, from ``Modules/zlibmodule.c``
12491249

12501250
/*[python input]
12511251

1252-
class uint_converter(CConverter):
1252+
class capped_uint_converter(CConverter):
12531253
type = 'unsigned int'
1254-
converter = 'uint_converter'
1254+
converter = 'capped_uint_converter'
12551255

12561256
[python start generated code]*/
1257-
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
1257+
/*[python end generated code: output=da39a3ee5e6b4b0d input=35521e4e733823c7]*/
12581258

1259-
This block adds a converter to Argument Clinic named ``uint``. Parameters
1260-
declared as ``uint`` will be declared as type ``unsigned int``, and will
1261-
be parsed by the ``'O&'`` format unit, which will call the ``uint_converter``
1262-
converter function.
1263-
``uint`` variables automatically support default values.
1259+
This block adds a converter to Argument Clinic named ``capped_uint``. Parameters
1260+
declared as ``capped_uint`` will be declared as type ``unsigned int``, and will
1261+
be parsed by the ``'O&'`` format unit, which will call the
1262+
``capped_uint_converter`` converter function. ``capped_uint`` variables
1263+
automatically support default values.
12641264

12651265
More sophisticated custom converters can insert custom C code to
12661266
handle initialization and cleanup.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL