[NumPy-Tickets] [NumPy] #1729: Wrong behavior: asarray & object with __array__ sets owndata to True

NumPy Trac numpy-tickets@scipy....
Sun Jan 30 18:17:58 CST 2011


#1729: Wrong behavior: asarray & object with __array__ sets owndata to True
------------------------+---------------------------------------------------
 Reporter:  pv          |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  2.0.0   
Component:  numpy.core  |     Version:  1.5.0   
 Keywords:              |  
------------------------+---------------------------------------------------
 Is this really intended:
 {{{
 import numpy as np
 class Fake(object):
     def __init__(self, data):
         self._data = data
     def __array__(self):
         return self._data

 x = np.array([1,2,3])
 print np.asarray(Fake(x)).flags.owndata
 # -> True
 }}}

 This seems to break the invariant that only one array object can have
 `owndata` True?

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


More information about the NumPy-Tickets mailing list