Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Larry Hastings
On 06/29/2013 06:24 PM, Serhiy Storchaka wrote: Definitely Argument Clinic should use converters for unsigned integers without wraparound by default. Argument Clinic 1.0 is a thin layer over PyArg_ParseTuple. But it will support these sorts of converters, and if people have bright ideas abo

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Serhiy Storchaka
29.06.13 18:16, Nadeem Vawda написав(ла): I ran into the same problem in the _lzma module. My solution was to define a custom converter that does an explicit check before returning the value (see http://hg.python.org/cpython/file/default/Modules/_lzmamodule.c#l134). Definitely Argument Clinic s

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Nadeem Vawda
On Thu, Jun 27, 2013 at 12:07 AM, Victor Stinner wrote: > I would to parse an integer in [0; UINT_MAX] to fix the zlib module on > 64-bit system: > http://bugs.python.org/issue18294 > > How should I implement that? Use "O" format and then use > PyLong_Check(), PyLong_AsLong(), and check value <= U

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-26 Thread Guido van Rossum
On Wed, Jun 26, 2013 at 3:07 PM, Victor Stinner wrote: > I don't understand why the B, H, I, k formats of PyArg_ParseTupe() do > not check for overflow, whereas formats for signed numbers do check > for overflow. What is the useful of ignoring overflow? > http://docs.python.org/3/c-api/arg.html I

[Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-26 Thread Victor Stinner
Hi, I don't understand why the B, H, I, k formats of PyArg_ParseTupe() do not check for overflow, whereas formats for signed numbers do check for overflow. What is the useful of ignoring overflow? http://docs.python.org/3/c-api/arg.html I would to parse an integer in [0; UINT_MAX] to fix the zlib