[Numpy-discussion] Int bitsize in python and c

Martin Raspaud martin.raspaud@smhi...
Thu Mar 18 08:33:30 CDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I work on a 64bit machine with 64bits enable fedora on it.

I just discovered that numpy.int on the python part are 64bits ints, while
npy_int in the C api are 32bits ints.

I can live with it, but it seems to be different on 32bit machines, hence I
wonder what is the right way to do when retrieving an array from python to C.

Here is what I use now:
data_pyarray = (PyArrayObject *)PyArray_ContiguousFromObject(data_list,
PyArray_INT, 1, 2);

but that implies that I send np.int32 arrays to the C part.

Should I use longs instead ?

Regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLoiuqAAoJEBdvyODiyJI4TikIAIUpnsIxxeYMlz8qEeZL/UUB
3UTGOCcrcIICPVRW/CLbOss5W4xe8BTxPslRXZfckSuMMgHHiD3rGC302gZgfvsb
mS6fcDzTOboJ1da1xoczpJYVCwvC9aWAPEjEDa6jyI331pDAXABurmjzIQqjowDw
1cWX5swt9MeSn0yOa/a2EYQP8Xj+n0RQlSIutEDR5jktlK3yyHX8LAtZd0tAPgrd
hr9RGwO09Hwcn7ke4B9SwHF7Zg/mBrHgdTdaufW+kjPleZ479lyMO8r/LsWbehVo
usQ5wefnmnzhDhOoxff8aKUo8D+Ne8gqxI4BR5EOAdHfQ2uUPpBA91pJ0cNbzZI=
=E0XH
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 259 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100318/e5e99ed6/attachment.vcf 


More information about the NumPy-Discussion mailing list