[MATRIX-SIG] Seg fault with slice

Janko Hauser jhauser@ifm.uni-kiel.de
Mon, 24 Nov 1997 21:07:38 +0100 (CET)


Ha, as Konrad has ``clearly'' shown my first try was stupid, heh it
was a try :-). The result of the second try is nslice.py, which isn't
totally stupid, although the __cmp__ is not really satisfactory. I
think to use xrange to build the indices, but the result of cmp of two
xranges is also not easy to interpret. Will see.

But many thanks for the patch. Do the people from LLNL save this
patch?

__Janko
 
viennet@lipn.univ-paris13.fr writes:
 > 
 > Janko Hauser writes:
 > > 
 > > Any ideas? seg faults are real show stopper in python.
 > > 
 > 
 >  Thanks to people like yourself, experimenting strange ideas, seg
 > faults are exceptional...
 > 
 >  I didn't understood your example, but Python should not crash.
 > The bug is in NumPy/arrayobject.c. Here is a quick patch:
 > 
 > 646,647c646,651
 > <               if (!is_slice) op1 = PySequence_GetItem(op, i);
 > < 
 > ---
 > >              if (!is_slice) {
 > >                 if (!(op1=PySequence_GetItem(op, i))) {
 > >                   PyErr_SetString(PyExc_IndexError, "invalid index");
 > >                   return -1;
 > >                 }
 > >               }
 > 
 > 

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________