I want to allocate numbers for a numpy array in C / C ++ and pass them to python as a numpy array. What can I do with PyArray_SimpleNewFromData .
The problem is that I also want to register a function that should be called from Python when the numpy array reference count reaches zero, and this will cause some destructor semantics on the C side ... Here is a pseudo-example that I need:
float* arr; PyObject* np_arr; void (*destructor)(float* arr);
np_arr =
is there an easy way to do this?
source
share