[Pyrex] converting python objects to 'unsigned'

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 24 03:06:41 CET 2005


Bob Ippolito wrote:
> 
> On Mar 23, 2005, at 3:13 PM, Phil Frost wrote:
> 
>> Looking at the generated C, Pyrex is using "i" for unsigned in
>> PyArg_ParseTupleAndKeywords. This has two undesirable effects:

> Did you read <http://docs.python.org/api/intObjects.html> ?
> 
> unsigned long PyInt_AsUnsignedLongMask(PyObject *io)

But Bob is talking about converting arguments using
PyArg_ParseTuple, and there doesn't seem to be any
ParseTuple format character for unsigned ints.

In the next release you will be able to work around
this in Pyrex code by leaving the argument as a Python
object, and assigning it to a local variable of type
unsigned int. (I need to fix Pyrex to use
PyInt_AsUnsignedLongMask first, though).

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list