[Numpy-tickets] [NumPy] #282: _convert_from_dict ignores align switch when offsets are passed

NumPy numpy-tickets at scipy.net
Sun Sep 17 11:50:30 CDT 2006


#282: _convert_from_dict ignores align switch when offsets are passed
-----------------------------+----------------------------------------------
 Reporter:  martin_wiechert  |       Owner:  somebody   
     Type:  defect           |      Status:  new        
 Priority:  normal           |   Milestone:  1.0 Release
Component:  Other            |     Version:  devel      
 Severity:  normal           |    Keywords:             
-----------------------------+----------------------------------------------
 Even if one explicitly specifies offsets it is often desirable to have the
 record as whole aligned.

 Example:

 {{{
 # python:
 d = {'formats': ['<f8', '<i4'],
      'offsets': [8,16],
      'names': ['a', 'b']}
 /* C: */
 descr = _convert_from_dict (d, 1);
 }}}

 As the align switch is ignored descr->elsize will be 20, which will
 typically prompt "unaligned access" messages on IA64 if an array with
 descr as dtype is used.

 align is ignored, because maxalign is only updated in the else clause of
 the offsets test (multiarraymodule.c line 4555 (numpy1.0rc1.dev3171)).
 Thus if offsets are given maxalign stays zero and totalsize is not adapted
 (line 4615).

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


More information about the Numpy-tickets mailing list