[Numpy-tickets] [NumPy] #314: array factory aborts when passed a list with a void type inside

NumPy numpy-tickets at scipy.net
Wed Oct 4 07:50:20 CDT 2006


#314: array factory aborts when passed a list with a void type inside
------------------------+---------------------------------------------------
 Reporter:  faltet      |        Owner:  somebody   
     Type:  defect      |       Status:  new        
 Priority:  normal      |    Milestone:  1.0 Release
Component:  numpy.core  |      Version:  devel      
 Severity:  normal      |   Resolution:             
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by faltet):

 Also, this can be worth noting (maybe related with above, but maybe not):

 {{{
 In [5]:rows=[(0,)]
 In [6]:descr=[('x', 'i4')]
 In [7]:scra = numpy.array(rows, dtype=descr)[0]
 In [8]:numpy.rec.array([rows[0]], dtype=descr)
 Out[8]:
 recarray([(0,)],
       dtype=[('x', '<i4')])
 # Good, but...
 In [9]:numpy.rec.array([scra], dtype=descr)
 ---------------------------------------------------------------------------
 exceptions.ValueError                                Traceback (most
 recent call last)

 /home/faltet/python.nobackup/numpy/<ipython console>

 /usr/lib/python2.4/site-packages/numpy/core/records.py in array(obj,
 dtype, shape, offset, strides, formats, names, titles, aligned, byteorder)
     500             return fromrecords(obj, dtype=dtype, shape=shape,
 **kwds)
     501         else:
 --> 502             return fromarrays(obj, dtype=dtype, shape=shape,
 **kwds)
     503
     504     elif isinstance(obj, recarray):

 /usr/lib/python2.4/site-packages/numpy/core/records.py in
 fromarrays(arrayList, dtype, shape, formats, names, titles, aligned,
 byteorder)
     302     # populate the record array (makes a copy)
     303     for i in range(len(arrayList)):
 --> 304         _array[_names[i]] = arrayList[i]
     305
     306     return _array

 ValueError: setting an array element with a sequence.
 In [10]:
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/314#comment:2>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list