From: Konrad H. <hi...@cn...> - 2002-12-02 11:40:27
|
Joachim Saul <li...@js...> writes: > But what if I create a reference to foo.bar, and later delete foo, > i.e. > > >>> b = foo.bar > >>> del foo > > Now the data pointer in b refers to freed data! In the mentioned And that is why the condition for using PyArray_FromDimsAndData is that the data space passed is not freed before the end of the process. > survive the actual 'foo' object. However, I want to program it the > 'clean' way; any hints on how to do it properly would therefore be > highly welcome. I see only one clean solution: implement your own array-like object that represents foo.bar. This object would keep a reference to foo and release it when it is itself destroyed. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |