[Numpy-discussion] Possible bug in PyArray_RemoveSmallest?

Albert Strasheim fullung at gmail.com
Thu Mar 15 06:11:15 EDT 2007


Hello all

I was poking around in the NumPy internals and I came across the 
following code in PyArray_RemoveSmallest in arrayobject.c:

intp sumstrides[NPY_MAXDIMS];

...

for (i=0; i<multi->nd; i++) {
    sumstrides[i] = 0;
    for (j=0; j<multi->numiter; j++) {
        sumstrides[i] = multi->iters[j]->strides[i];
    }
}

This might be a red herring, but from the name of the variable 
(sumstrides) and the code (iterating over a bunch of strides) I'm 
guessing the author might have intended to write:

sumstrides[i] += multi->iters[j]->strides[i];

Cheers,

Albert



More information about the NumPy-Discussion mailing list