[Numpy-discussion] Change array memory ownership status

Marc POINOT Marc.Poinot at onera.fr
Wed Sep 5 05:05:00 EDT 2007


I want to change the "status" of a numpy array.
I mean this array was created by a server application using PyArray_FromDimsAndData that sets the NPY_OWNDATA flag to False.

The server application believes the client would free the memory.
But there are more than one client application and none knows who is in charge of freeing this memory.
Then I want to set the flag NPY_OWNDATA to True to tell the server to do the job when it finishes the script.

How can I do that, I mean at the Python interface level, not the C API.

>>> print a.flags.owndata
True
>>>
>>> a.flags.owndata=False
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: attribute 'owndata' of 'numpy.flagsobj' objects is not writable
>>>

Or should I have to write my own function set/get for OWNDATA ?
The get is there but I can't get the set...

-MP-
-----------------------------------------------------------------------
  Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84  Fax:+33.1.46.73.41.66

  Avertissement/disclaimer http://www.onera.fr/onera-en/emails-terms





More information about the NumPy-Discussion mailing list