[NumPy-Tickets] [NumPy] #1452: pickle memmap'd arrays (patch + tests)

NumPy Trac numpy-tickets@scipy....
Mon May 3 23:14:56 CDT 2010

#1452: pickle memmap'd arrays (patch + tests)
 Reporter:  brentp       |       Owner:  somebody    
     Type:  enhancement  |      Status:  needs_review
 Priority:  normal       |   Milestone:              
Component:  Other        |     Version:              
 Keywords:               |  

Comment(by brentp):

 not sure i follow. this test--with the fp1, c variables loading a memmap
 with offset, the pickling with further offset passes in python2.5 and 2.6
     def test_pickle_offset(self):

         a = array('ABCDEFGHIJ', dtype='c')
         fp = memmap(self.tmpfp, dtype=a.dtype, mode='w+', shape=a.shape)

         fp[:] = a
         del fp

         fp1 = memmap(self.tmpfp, dtype=a.dtype, mode='r',
                                           offset=1, shape=(a.shape[0] -
         pstr = fp1.dumps()
         fp_loaded = loads(pstr)

         self.assertEquals(fp_loaded.offset, 1)
         self.assertEquals(fp1.shape, fp_loaded.shape)
         self.assertEquals(fp_loaded[0], 'B')

         c = fp1[2:]
         d = loads(c.dumps()) # so now 3 'things in'
         self.assertEquals(d[0], 'D')

         del fp1
         del fp_loaded

 this works because as the pickling works now, __new__ handles the
 initialization given the arguments. what am i missing?

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

More information about the NumPy-Tickets mailing list