[Numpy-discussion] Int bitsize in python and c

Martin Raspaud martin.raspaud at smhi.se
Thu Mar 18 11:32:22 EDT 2010


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

Dag Sverre Seljebotn skrev:
> Martin Raspaud wrote:
> 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.
>   
> 
>> np.intc

Thanks !

But I'm also wondering about the C side. How can I make sure my conversion to
PyArray goes well ? Should I use PyArray_LONG ? or is this also platform dependent ?

Regards,
Martin

> 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

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion at scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

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

iQEcBAEBAgAGBQJLokeGAAoJEBdvyODiyJI4tv0H/R+sUTIfvH2JejX85XHUGtOw
mUwDkAD2ePj9qNc62RJJQg75B58useoe8zHSNj2NFG7U5fhFYviIQImugJ4dAESo
z4WgrIRQE29apyCScRid8lXBHDL8kvJtpI+G/uFQ62jxSzheIDpEEzKUlDMYZeIA
MLFhMWqzHVmuNEUVyUdPt+ryL6T23t/uzQEtpt+QKt5U2Vj/dYerRRjilMA5bvLn
r+xGIFQqKOLW8MzwJ+zo0nkea7JvfDBbSZdU2oS5yuQ8rdXR/v9OeSfzTI5fuI7C
erUTkEozZ+5jShZbmJbihJcjjw61KleF7QfiySOahqW/E/gKYWRSX5doB4rF35A=
=MDuv
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 260 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100318/72eb58c5/attachment.vcf>


More information about the NumPy-Discussion mailing list