[Numpy-discussion] NumPy C API question

Stefan Seefeld stefan at seefeld.name
Wed May 21 19:03:50 EDT 2014


I would like to expose an existing (C++) object as a NumPy array to
Python. Right now I'm using PyArray_New, passing the pointer to my
object's storage. It now happens that the storage point of my object may
change over its lifetime, so I'd like to change the pointer that is used
in the PyArrayObject. Is there any API to do this ? (I'd like to avoid
allocating a new PyArrayObject, as that is presumably a costly operation.)
If not, may I access (i.e., change) the "data" member of the array
object, or would I risk corrupting the application state doing that ?

Many thanks,


      ...ich hab' noch einen Koffer in Berlin...

More information about the NumPy-Discussion mailing list