[MATRIX-SIG] Seg fault with slice
Konrad Hinsen
hinsen@ibs.ibs.fr
Mon, 24 Nov 1997 18:10:39 +0100
> In the attempt to make the nslice object more like a slice I tried a
> similar approach like Konrad Hinsen in his indexing.py but get a
> seg. fault if len returns sys.maxint. This happens only on Linux not on
> an alpha box. There the error is:
I don't quite understand your code. What is nslice supposed to do?
As it is now, the __getslice__ method of nslice never gets called,
which doesn't seem intentional. When you index the array with an
nslice object, NumPy sees it as a sequence. It asks for the length
and finds maxint, meaning maxint dimensions! I didn't check in detail
where the crash comes from, but I suppose it's some kind of memory
overflow due an extremely unreasonable request.
I *suppose* you want a[n_sl] to call the __getslice__ method,
but that doesn't happen!
In fact, your whole approach won't work, because array objects currently
accept only integers and slice objects in an indexing tuple.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale | Fax: +33-4.76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________