[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

Mark Dickinson report at bugs.python.org
Sun May 12 19:48:48 CEST 2013


Mark Dickinson added the comment:

Some comments for the first patch (I haven't really looked at the second):

- I would much prefer PyLong_AsIntMax_t not to use nb_int;  it should work only for instances of 'int' (just as PyLong_AsSsize_t and PyLong_AsSize_t currently do).

- There's a missing 'versionadded' for PyLong_AsIntMax_t in the docs.

- Will AC_CHECK_SIZEOF(intmax_t) work on platforms that don't define intmax_t?  I don't know whether the #define created by the earlier AC_TYPE_INTMAX_T is available at that point.  We'll probably find out from the buildbots.

- Do we also need an addition to PC/pyconfig.h to define (u)intmax_t and SIZEOF_(U)INTMAX_T on Windows?

- For the PyLong_As* functions, it may be more efficient to code the conversion directly instead of using _PyLong_AsByteArray.

- The PyLong_As* functions assume that intmax_t and uintmax_t have no padding bits, no trap representation, and (in the case of intmax_t) use two's complement.  I think it's fine to assume all these things, but we should also either document or test those assumptions.

- The patch lacks tests.

----------
nosy: +skrah

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17870>
_______________________________________


More information about the Python-bugs-list mailing list