[Numpy-discussion] possible bug in C-API

Sebastian Haase haase at msg.ucsf.edu
Thu Aug 24 16:05:21 CDT 2006

I noticed in 
numpy/numarray/_capi.c: NA_NewAllFromBuffer()

a) the original numarray function could create arrays of any (ndim) shape,
while PyArray_FromBuffer()  looks to me that the returned array is always 1D.

b) in the code part
<selected lines from code>
 npy_intp size = dtype->elsize;
 for ... 
size *= self->dimensions[i];
 PyArray_FromBuffer(bufferObject, dtype, size, byteoffset);
</selected lines from code>

Is "size" here a muplitple of the itemsize !?   I think I got a crashed (my 
code) that I fixed when I set size to (the equivalent of) N.prod(array.shape)

Sebastian Haase

More information about the Numpy-discussion mailing list