[Numpy-discussion] question about the data entry in the __array_interface__
Sun Apr 7 08:26:18 CDT 2013
I am currently working with a C extension that wraps a C library.
The library contains a function that takes, amongst others, a 'void *'
as an argument. Now, I would like for that function to be able to read
the 'data' buffer of a numpy array and thus need to pass address from
Python down into the C-extension.
I know that the address is contained in the 'data' field of the
'__array_interface__' and is either an int or a long. My guess is that
this depends on the architecture of the system, i.e. 32 vs 64 bit
My question is: what is the correct type to use when using
PyArg_ParseTuple to convert the value. I am currently using:
k (integer) [unsigned long]
Convert a Python integer or long integer to a C unsigned long
without overflow checking.
The reason I chose 'k' is because it seems to be the only option that
can deal with both Python int and long types. And was wondering if this
is the correct choice. Also note that whatever it is, it will be cast to
a 'void *' later.
Thanks in advance for advice.
FYI: the gory details can be found in:
More information about the NumPy-Discussion