[Numpy-discussion] Array data ownership
Marc.Poinot at onera.fr
Tue Nov 19 00:58:03 CST 2002
I use the Numpy C API to produce/use some PyArrayObjects. To set the
allocated memory zone, I use the PyArray_FromDimsAndData function, which
is described to "be used to access global data that will never be freed".
That's what I want. Or more exactly, I want "global data that will never be
freed by Numpy, until I tell it to do so !"
I mean some of my arrays are allocated and used as PyArrayObject data,
but I want some of them to be seen by Numpy as its own data. I want it to
deallocate the data at delete time. My questions are :
 Is PyArray_FromDimsAndData the right function or should I use another way ?
 Can I use the PyArrayObject.flags bit "owns the data area" to set it
after the PyArray_FromDimsAndData call ? In the case of "yes", which
is the bit rank ? The fourth starting from right ? Any macro already
doing this ? Will I break the PyArrayObject consistency ?
Marcvs [alias yes I can go into the code... I though OO was reading docs
and using interfaces ;]
More information about the Numpy-discussion