[Numpy-discussion] Segfault on wrong use of indexing

Arnar Flatberg arnar.flatberg at gmail.com
Mon Sep 17 13:35:51 EDT 2007


Thanks for the fast reply.

Everything works fine with a repos checkout ('1.0.4.dev4045').

I was using the default package of Ubuntu Feisty, and must admit that
I like to stay close to the package manager, especially with python
stuff. With Gutsy on the doorstep, perhaps this not a serious issue (I
see Gutsy uses 1.0.3). I have tested this behavior on three machines
running Ubunut Feisty with similar result.

On 9/17/07, Travis E. Oliphant <oliphant at enthought.com> wrote:
> Arnar Flatberg wrote:
> > However, when I tried to to insert a 1-dim array with a 'two-dim'
> > index things went wrong:
> >
> >>>> a[[0],:] = [2,2]
> >>>>
> > Segmentation fault
> >
> >
>
> I do not see this error in latest trunk of numpy (I suspect it's also
> not there in the latest release).
> > Am I just a horrible user of indices, or is this a bug?
> >
> It was a bug.  A segfault with pure Python is *always* a bug (unless you
> are using ctypes).
> > The situation were incorrect use of indices just passes silently is
> > what I find a little disturbing.
> >
> Which situation is this exactly?

sometimes a segfault does not occur, that is:
>>> import numpy as n
>>> a = n.random.rand(4,2)
>>> a[[0],:] = [2,2]
>>> a
array([[ 2.        ,  0.        ],
       [ 0.23502786,  0.13993698],
       [ 0.9598841 ,  0.74795152],
       [ 0.95212598,  0.52698868]])

, which is quite spooky. (This is with old numpy of course)

> Thanks for the report.   Don't forget about the Trac pages where bugs
> (filed as "tickets") can be reported, checked, and fixed.   See the
> www.scipy.org site under the Developer tab for more details.
>
> Best regards,
>
>
> -Travis
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

Again Thank you

Arnar



More information about the NumPy-Discussion mailing list