[Numpy-discussion] possible bug in dtype for records

Stefan van der Walt stefan at sun.ac.za
Wed Feb 15 10:38:05 CST 2006


Using

In [3]: numpy.__version__
Out[3]: '0.9.5.2024'

I see the following:

In [4]: import numpy as N

In [5]: ctype = N.dtype({'names': ('x', 'y', 'z'), 'formats' : [N.float32, N.float32, N.float32]})

In [6]: ctype
Out[6]: dtype([('x', '<f4'), ('y', '<f4'), ('z', '<f4')])

In [7]: N.array([(1,2,3), (4,5,6)], dtype=ctype)
Segmentation fault

However, when I use a mutable list for defining dtype, i.e.

'names': ['x', 'y', 'z'] instead of
'names': ('x', 'y', 'z')

it works fine.

Is this expected behaviour?

Regards
Stéfan




More information about the Numpy-discussion mailing list