[Numpy-discussion] Yet another problem in CVS numarray

Francesc Altet faltet at carabos.com
Thu Nov 10 09:50:44 CST 2005


Ups, I've made a cvs update and not luck yet:

>>> import numarray; numarray.__version__
'1.4.2'
>>> import Numeric; Numeric.__version__
'24.1'
>>> num=Numeric.array([1,2,3,4])
>>> numarray.array(num)
array([1, 2, 3, 4])
>>> num2=num[::2]
>>> numarray.array(num2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 380, 
in array
    a = a.astype(type)
  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 867, 
in astype
    return self.copy()
  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 927, 
in copy
    c = _gen.NDArray.copy(self)
  File "/usr/lib/python2.4/site-packages/numarray/generic.py", line 724, in 
copy
    arr._itemsize)
numarray.libnumarray.error: copy4bytes: access beyond buffer. offset=11 
buffersize=8

I've made a rm -rf of old numarray extension, and rebuild everything
from scratch.

Regards,

A Dijous 10 Novembre 2005 17:47, vàreu escriure:
> Francesc Altet wrote:
> >El dv 04 de 11 del 2005 a les 15:35 -0500, en/na Todd Miller va
> >
> >escriure:
> >>This turned out to be a problem with the way numarray handles Numeric's
> >>multi-segment buffer protocol.   I worked around this by implementing
> >>David Cooke's __array_struct__ array interface for numarray.
> >
> >Did you commit the changes in CVS? I'm getting the same problems with
> >
> >the current CVS version:
> >>>>Numeric.__version__
> >
> >'24.1'
> >
> >>>>import numarray
> >>>>numarray.__version__
> >
> >'1.4.2'
> >
> >>>>num=Numeric.array([1,2,3,4])
> >>>>numarray.array(num)
> >
> >array([1, 2, 3, 4])
> >
> >>>>num2=num[::2]
> >>>>numarray.array(num2)
> >
> >Traceback (most recent call last):
> >  File "<stdin>", line 1, in ?
> >  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line
> >380, in array
> >    a = a.astype(type)
> >  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line
> >867, in astype
> >    return self.copy()
> >  File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line
> >927, in copy
> >    c = _gen.NDArray.copy(self)
> >  File "/usr/lib/python2.4/site-packages/numarray/generic.py", line 724,
> >in copy
> >    arr._itemsize)
> >numarray.libnumarray.error: copy4bytes: access beyond buffer. offset=11
> >buffersize=8
>
> This turned out to be  a bug in numarray buffer size determination...
> striding wasn't accounted for so the buffer appeared to be too small.
> It's fixed now in CVS.  There's still a backward compatibility problem
> for old Numerics which don't implement __array_struct__ and get
> multi-segment buffers through __array_data__.
>
> Regards,
> Todd

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"





More information about the Numpy-discussion mailing list