[Pyrex] converting python objects to 'unsigned'

Phil Frost indigo at bitglue.com
Wed Mar 23 21:13:43 CET 2005


I have a method as such:

def foo(unsigned i):
    pass

Looking at the generated C, Pyrex is using "i" for unsigned in
PyArg_ParseTupleAndKeywords. This has two undesirable effects:

foo(-16)
# raises no exception, and makes i = 4294967280

foo(4026531840L)
# raises OverflowError, although 4026531840 is well within the range of
# an unsigned.

Looking at the Python C API, there doesn't seem to be a good solution.
Ideas?



More information about the Pyrex mailing list