summaryrefslogtreecommitdiffstats
path: root/Doc/howto/clinic.rst
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-11-20 08:13:35 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-11-20 08:13:35 (GMT)
commite99e97762cc75ad94056275ddcae9c84d63a3412 (patch)
treef16040197bf0122ce6aded03018b4ee6fee03679 /Doc/howto/clinic.rst
parentd13cade3817cf452b7c98e9df96b15c6da68201a (diff)
downloadcpython-e99e97762cc75ad94056275ddcae9c84d63a3412.zip
cpython-e99e97762cc75ad94056275ddcae9c84d63a3412.tar.gz
cpython-e99e97762cc75ad94056275ddcae9c84d63a3412.tar.bz2
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.
Diffstat (limited to 'Doc/howto/clinic.rst')
-rw-r--r--Doc/howto/clinic.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst
index 7524c4a..b04edea 100644
--- a/Doc/howto/clinic.rst
+++ b/Doc/howto/clinic.rst
@@ -1249,18 +1249,18 @@ Here's the simplest example of a custom converter, from ``Modules/zlibmodule.c``
/*[python input]
- class uint_converter(CConverter):
+ class capped_uint_converter(CConverter):
type = 'unsigned int'
- converter = 'uint_converter'
+ converter = 'capped_uint_converter'
[python start generated code]*/
- /*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
+ /*[python end generated code: output=da39a3ee5e6b4b0d input=35521e4e733823c7]*/
-This block adds a converter to Argument Clinic named ``uint``. Parameters
-declared as ``uint`` will be declared as type ``unsigned int``, and will
-be parsed by the ``'O&'`` format unit, which will call the ``uint_converter``
-converter function.
-``uint`` variables automatically support default values.
+This block adds a converter to Argument Clinic named ``capped_uint``. Parameters
+declared as ``capped_uint`` will be declared as type ``unsigned int``, and will
+be parsed by the ``'O&'`` format unit, which will call the
+``capped_uint_converter`` converter function. ``capped_uint`` variables
+automatically support default values.
More sophisticated custom converters can insert custom C code to
handle initialization and cleanup.