[Numpy-discussion] Bug

Louis Cordier lcordier at point45.com
Fri Apr 28 06:36:10 CDT 2006


Hi, I am not sure if this is the proper place to do a bug post.
I looked at the active tickets on http://projects.scipy.org/scipy/numpy/
but didn't feel confident to go and create a new one. ;)

Anyway the current release version 0.9.6 have some broken behavior.
I guess some example code would illustrate it best.

---8<----------------

>>> z = numpy.zeros((10,10), 'O')
>>> z.fill(None)
>>> z.fill([])
Segmentation fault (core dumped)

This happens on both Linux and FreeBSD machines.
(both builds use *_lite versions of Lapack)

Linux bellagio 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 
i386 GNU/Linux
Python 2.4.1
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)

FreeBSD cerberus.intranet 5.4-RELEASE-p12 FreeBSD 5.4-RELEASE-p12 #0: Wed 
Mar 15 16:06:48 UTC 2006
Python 2.4.2
gcc version 3.4.2 [FreeBSD] 20040728

I assume fill() will need to make a copy, of the object
for each coordinate in the matix.

---8<----------------

While,

>>> import numpy
>>> z = numpy.zeros((2,2), 'O')
>>> z
array([[0, 0],
        [0, 0]], dtype=object)
>>> z.fill([1])
>>> z
array([[1, 1],
        [1, 1]], dtype=object)

and

>>> z.fill([1,2,3])
>>> z
array([[1, 1],
        [1, 1]], dtype=object)


I would have expected,

>>> z
array([[[1], [1]],
        [[1], [1]]], dtype=object)

and

>>> z
array([[[1, 2, 3], [1, 2, 3]],
        [[1, 2, 3], [1, 2, 3]]], dtype=object)


Regards, Louis.

-- 
Louis Cordier <lcordier at point45.com> cell: +27721472305
Point45 Entertainment (Pty) Ltd. http://www.point45.org





More information about the Numpy-discussion mailing list