Filip Wasilewski wrote: >Hi Travis, > >this is a great example of the __array_interface__ usage. > > > >The second seems to be more complex and may be a more general. The >memory of string created by self.tostring() seems to be deallocated >before array is created (v 0.9.9.2788, win). >Everything works fine after storing the reference to data, but this >probably should be done somewhere else: > > def __get_array_interface__(self): > new = {} > shape, typestr = _conv_type_shape(self) > new['shape'] = shape > new['typestr'] = typestr > new['data'] = self.tostring() > self._str_data = new['data'] # a dirty hack > return new > > > This is now fixed in NumPy. The problem was that when the "buffer" interface was used a reference to the object was kept (but not the buffer). In this case it's the reference to the buffer that is needed.
-Travis ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion