PyArray_BASE equivalent in python

Hi, I as the title says, I am looking for a way to set in python the base of an ndarray to an object. Use case is porting qimage2ndarray to PySide where I want to do something like: In [1]: from PySide import QtGui In [2]: image = QtGui.QImage('/home/peter/code/pyTools/sandbox/images/faceDemo.jpg') In [3]: import numpy as np In [4]: a = np.frombuffer(image.bits()) --> I would like to do something like: In [5]: a.base = image --> to avoid situations such as: In [6]: del image In [7]: a Segmentation fault (core dumped) The current implementation of qimage2ndarray uses a C function to do PyArray_BASE(sipRes) = image; Py_INCREF(image); But I want to avoid having to install compilers, headers etc on target machines of my code just for these two lines of code. Thanks, P

participants (3)
-
Nathaniel Smith
-
Peter Rennert
-
Robert Kern