[NumPy-Tickets] [NumPy] #1992: data leakage with S0 in record dtype

NumPy Trac numpy-tickets@scipy....
Sun Dec 11 23:13:16 CST 2011


#1992: data leakage with S0 in record dtype
--------------------+-------------------------------------------------------
 Reporter:  hpaulj  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  1.5.1      
 Keywords:          |  
--------------------+-------------------------------------------------------
 As of numpy 1.5.1 (and earlier)


 {{{
 >>> x = np.zeros(1, 'S,i')
 >>> x['f0']='A'
 >>> x
 array([('', 65)], dtype=[('f0','|S0'),('f1','<i4')])
 }}}


 In contrast, if the assigned dtype is
 'S1,i'
 , x is then ('A',0)

 So not only is there ambiguity as to what a 'S' dtype produces (as
 discussed in other tickets), but assignment to that record leaks over to
 the adjacent field.

 I first encountered this in an introduction to numpy for Ironpython, but
 it occurs in all versions that I've tested.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1992>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list