[NumPy-Tickets] [NumPy] #1760: Copying strided slices does not work on structured arrays with MD fields

NumPy Trac numpy-tickets@scipy....
Mon Mar 7 10:54:40 CST 2011


#1760: Copying strided slices does not work on structured arrays with MD  fields
--------------------+-------------------------------------------------------
 Reporter:  faltet  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  devel      
 Keywords:          |  
--------------------+-------------------------------------------------------
 The next code snippet shows the problem:

 {{{
 import numpy as np

 print "numpy version:", np.__version__

 r=np.fromstring('abcd'*16*5, dtype='i4,(2,3)u2')
 #start, stop, step = 0, 5, 1    # step == 1 works
 start, stop, step = 0, 5, 2
 r2 = r[start:stop:step]
 print "r -->", r[start]['f1']
 print "r2 -->", r2[0]['f1']
 assert np.all(r[start]['f1'] == r2[0]['f1'])
 }}}

 Using numpy 1.5.x:

 {{{
 numpy version: 1.5.0.dev
 r --> [[25185 25699 25185]
  [25699 25185 25699]]
 r2 --> [[25185 25699 25185]
  [25699 25185 25699]]
 }}}

 Using current 1.6 in git master:

 {{{
 numpy version: 1.6.0.dev-c081ad7
 r --> [[25185 25699 25185]
  [25699 25185 25699]]
 r2 --> [[25185 25185 25185]
  [25699 25699 25699]]
 Traceback (most recent call last):
   File "/tmp/copy-recarr.py", line 12, in <module>
     assert np.all(r[start]['f1'] == r2[0]['f1'])
 AssertionError
 }}}

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


More information about the NumPy-Tickets mailing list