[SciPy-dev] there is a bug in PyArray_CheckFromAny ?

Luis Saavedra luis94855510@gmail....
Tue Mar 10 00:48:41 CDT 2009


Hi,

if o is a "vector" <numpy.ndarray of shape (n,)> and <dtype=int32>, the 
following lines:

po = PyArray_CheckFromAny(o,PyArray_DescrFromType(NPY_INT),0,0,
               NPY_FORCECAST|NPY_OUT_FARRAY|NPY_ELEMENTSTRIDES,NULL);
int *ver = (int *)((PyArrayObject *)po)->data;
printf("0: %d\n",ver[0]);
printf("1: %d\n",ver[1]);

show that:

0: 0
1: -1

regardless of the value (size>2). But if I modify the shape of "o" 
before the previous line, for example shape = (1,n), works fine!

Regards,
Luis.

PD: In debian squeeze:
$ dpkg -s python-numpy |grep Version
Version: 1:1.2.1-1
Python-Version: 2.4, 2.5




More information about the Scipy-dev mailing list