Python/C: unsigned Py_BuildValue, PyInt_FromLong

Christian Vogel chris-usenet at
Wed Feb 25 23:05:47 CET 2004

Mike C. Fletcher wrote:
>     PyLong_FromUnsignedLong
> Unsigned ints can be longer than Python 32-bit signed integers, so
> either do a check for the high-bit being set and use
> PyLong_FromUnsignedLong for that case and PyInt_FromLong otherwise, or
> just always use PyLong_FromUnsignedLong and eat the slight performance
> penalty of having longs everywhere.

Yes, now that you mention it, it's clear to me. Thanks for your help!


More information about the Python-list mailing list