From: Marc P. <Mar...@on...> - 2002-11-19 08:57:32
|
Hi all, 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 : [1] Is PyArray_FromDimsAndData the right function or should I use another way ? [2] 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 ;] |