[Numpy-discussion] Segmentation fault when dealing with nested records

Francesc Altet faltet at carabos.com
Fri Jan 20 09:59:04 CST 2006


Hi,

I'm starting to write a series of torture test for numpy and (nested)
heterogeneous arrays. I've found a first problem that causes a
segfault:

In [7]: dtype=[('x', '<i4', (2,)), ('Info', [('value', '<c16'), ('y2', '<f8'), 
('Info2', [('name', '|S2'), ('value', '<c16', (2,)), ('y3', '<f8', (2,)), 
('z3', '<u4', (2,))]), ('name', '|S2'), ('z2', '|u1')]), ('color', '|S2'), 
('info', [('Name', '|S2'), ('Value', '<c16')]), ('y', '<f8', (2, 2)), ('z', 
'|u1')]

In [9]: a=numpy.zeros((2,), dtype=dtype)

In [10]: a
Out[10]:
array([ (array([0, 0]), (0j, 0.0, ('', array([ 0.+0.j,  0.+0.j]), array([ 0.,  
0.]), array([0, 0], dtype=uint32)), '', 0), '', ('', 0j), array([[ 0.,  0.],
       [ 0.,  0.]]), 0),
       (array([0, 0]), (0j, 0.0, ('', array([ 0.+0.j,  0.+0.j]), array([ 0.,  
0.]), array([0, 0], dtype=uint32)), '', 0), '', ('', 0j), array([[ 0.,  0.],
       [ 0.,  0.]]), 0)], dtype=(void,146))

This is good. Now:

In [13]: a=numpy.zeros((30,), dtype=dtype)

In [14]: a
*** glibc detected *** free(): invalid pointer: 0xb7958680 ***
Out[14]: Aborted

If I find more things like this I'll report them.

Cheers,

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





More information about the Numpy-discussion mailing list