[NumPy-Tickets] [NumPy] #1619: Loading aligned dtype error

NumPy Trac numpy-tickets@scipy....
Thu Mar 10 22:39:12 CST 2011

#1619: Loading aligned dtype error
 Reporter:  Ihor.Melnyk      |       Owner:  somebody    
     Type:  defect           |      Status:  needs_review
 Priority:  highest          |   Milestone:  2.0.0       
Component:  numpy.core       |     Version:  devel       
 Keywords:  dtype alignment  |  
Changes (by rgommers):

 * cc: charris (added)


 Charles Harris sent a message to the Numpy mailing list about this ticket
 on March 3rd, probably good to reply there. For completeness, his

 In [2]: np.dtype('i1, i4, i1', align=True)
 Out[2]: dtype([('f0', '|i1'), ('', '|V3'), ('f1', '<i4'), ('f2', '|i1')])

 In [3]: dtype([('f0', '|i1'), ('', '|V3'), ('f1', '<i4'), ('f2', '|i1')])
 ValueError                                Traceback (most recent call

 /home/charris/<ipython console> in <module>()

 ValueError: two fields with the same name

 Note that the second field in the dtype is inserted for alignment purposes
 and isn't
 named. However, the list in the dtype can not be used to define a dtype
 because the
 empty name is replaced by 'f1', which conflicts with the following field.
 The patch
 attached to the ticket has a rather complicated work around for this that
 I would
 rather avoid. I would prefer some sort of reserved name for alignment
 fields, maybe
 something like '*0', '*1', etc. Another question I have is if alignment is
 supposed to
 be preserved across architectures, that is, should it be possible to
 pickle/savez on
 one architecture and read things in on another and still have the elements
 aligned. I
 suspect this isn't worth doing, but one way or the other should be

Ticket URL: <http://projects.scipy.org/numpy/ticket/1619#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list