From: <lu...@o2...> - 2010-06-02 23:41:26
|
Daniel Wheeler <dan...@gm...> writes: > It seems that the find() method (lin 2986 in in Src/ll_mat.c) has a > memory leak. Calling PyDECREF on a_row, a_col and a_val fixes this > issue. I propose the following change: I propose simpler (`N' is like `O' but without PyINCREF, details below): $ git diff diff --git a/Src/ll_mat.c b/Src/ll_mat.c index 230829a..1adee2f 100644 --- a/Src/ll_mat.c +++ b/Src/ll_mat.c @@ -3014,7 +3014,7 @@ static PyObject *LLMat_Find( LLMatObject *self, PyObject *args ) { } } - return Py_BuildValue( "OOO", + return Py_BuildValue( "NNN", PyArray_Return( a_val ), PyArray_Return( a_row ), PyArray_Return( a_col ) ); from File: python2.5-api.info, Node: Parsing arguments and building values ``N' (object) {[PyObject * }]' Same as `O', except it doesn't increment the reference count on the object. Useful when the object is created by a call to an object constructor in the argument list. |