Python/C: unsigned Py_BuildValue, PyInt_FromLong

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


Mike C. Fletcher wrote:
>     PyLong_FromUnsignedLong
>     http://www.python.org/doc/2.3.3/api/longObjects.html
> 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!

        Chris




More information about the Python-list mailing list