Message 190693 - Python tracker (original) (raw)
Another place where PyLong_FromIntMax_t() would help, _elementtree.c:
id = PyLong_FromSsize_t((Py_uintptr_t) self);
selectmodule.c defines PyLong_AsUintptr_t() with:
#if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P)
error uintptr_t does not match void *!
#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG)
define T_UINTPTRT T_ULONGLONG
define T_INTPTRT T_LONGLONG
define PyLong_AsUintptr_t PyLong_AsUnsignedLongLong
define UINTPTRT_FMT_UNIT "K"
define INTPTRT_FMT_UNIT "L"
#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG)
define T_UINTPTRT T_ULONG
define T_INTPTRT T_LONG
define PyLong_AsUintptr_t PyLong_AsUnsignedLong
define UINTPTRT_FMT_UNIT "k"
define INTPTRT_FMT_UNIT "l"
#elif (SIZEOF_UINTPTR_T == SIZEOF_INT)
define T_UINTPTRT T_UINT
define T_INTPTRT T_INT
define PyLong_AsUintptr_t PyLong_AsUnsignedLong
define UINTPTRT_FMT_UNIT "I"
define INTPTRT_FMT_UNIT "i"
#else
error uintptr_t does not match int, long, or long long!
#endif