On 10/21/13 13:22, [email protected] wrote:
> Hi all,
>
> I try to change my old C API numpy code to the 'new' API. I used to hack some 
> internal stuff in Numpy (yes it's bad...) and I wonder now how to change it.
>
Ok, I've used PyDataMem_RENEW to reallocate through the API, but there's no way 
to change data pointer or ownership flag.
I think the API miss with some kind of:

PyDataMem_SET(PyArrayObject *object, void *ptr) to set actual data field 
(hidden now in PyArrayObject_fields)

and

PyArray_SETOWNDATA(arr) PyArray_UNSETOWNDATA(arr) to set/unset OWN DATA flag if 
you change memory from external allocation (at my own risks)
PyArray_ISOWNDATA(arr) to check it

This is more or less what is performed in shape.c or ctors.c for example, I use 
to operate on arr->data and arr->flags but if you plan to hide it and to move 
it 'to a private 
header in a future release' it would be nice to have some macros.

-- 
-- ----------------------------------------------------------------------------
-- Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84  Fax:+33.1.46.73.41.66
-- Avertissement/disclaimer http://www.onera.fr/en/emails-terms
-- ----------------------------------------------------------------------------
--

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to