[Numpy-discussion] PyArray_ContiguousFromObject & PyDECREF

Konrad Hinsen hinsen at cnrs-orleans.fr
Mon Dec 1 02:11:06 CST 2003


On Monday 01 December 2003 07:15, Michiel Jan Laurens de Hoon wrote:

> In Chapter 12 ("Writing a C extension") in the Numerical Python manual, in
> the first example PyArray_ContiguousFromObject is used together with
> PyDECREF, while in the last example PyArray_ContiguousFromObject is used
> but the arrays are not PyDECREF'ed before the function returns. From
> Chapter 13 ("C API Reference") it seems that a PyDECREF is needed in both
> cases. Or am I missing something here? Is PyDECREF not needed for some
> reason in the last example?

It should be there, the second example as presented has a memory leak.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
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
-------------------------------------------------------------------------------





More information about the Numpy-discussion mailing list