[Numpy-discussion] Owndata flag

Fabrice Silva silva at lma.cnrs-mrs.fr
Fri Dec 16 10:16:25 EST 2011


Le vendredi 16 décembre 2011 à 15:33 +0100, Gregor Thalhammer a écrit :
> > Even better: the addendum!
> > http://blog.enthought.com/python/numpy/simplified-creation-of-numpy-arrays-from-pre-allocated-memory/
> > 
> > Within cython:
> > cimport numpy
> > numpy.set_array_base(my_ndarray,  PyCObject_FromVoidPtr(pointer_to_Cobj, some_destructor))
> > 
> > Seems OK.
> > Any objections about that ?
> 
> This is ok, but CObject is deprecated as of Python 3.1, so it's not portable to Python 3.2.

My guess is then that the PyCapsule object is the way to go...

-- 
Fabrice Silva




More information about the NumPy-Discussion mailing list