[Numpy-tickets] [NumPy] #426: give ctypes.data_as a reference to the array

NumPy numpy-tickets at scipy.net
Thu Jan 18 08:22:42 CST 2007

#426: give ctypes.data_as a reference to the array
 Reporter:  martin_wiechert  |       Owner:  somebody     
     Type:  enhancement      |      Status:  new          
 Priority:  normal           |   Milestone:  1.0.2 Release
Component:  numpy.core       |     Version:  devel        
 Severity:  normal           |    Keywords:               
 Is there a way to let a ctypes.POINTER have a reference to a python
 object? (If not, could the ctypes maintainer be talked into providing this
 If so, the pointer returned by ndarray.ctypes.data_as (ctypes.POINTER
 (ctypes.c_<type>)) should have a reference to the array.

 This would help avoid bugs like
 data_pointer = (a + b).ctypes.data_as (ctypes.POINTER (ctypes.c_double))
 c_library_function (data_pointer)
 which passes a stale pointer to c_library_function.

 If this is not feasible, at least a warning in the numpy documentation
 might be helpful.

Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/426>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list