[Numpy-discussion] python-numarray: _dotblas.dot calls spoils Py_None refcount

Todd Miller jmiller at stsci.edu
Mon Nov 20 13:21:09 EST 2006


This is in CVS now.  Thanks for the patch!

Todd

Achim Gaedke wrote:
> Hi!
>
> Using the latest numarray distribution for debian testing I found a bug.
> Executing the python script with python2.4 shows the decrement of None
> refcount:
>
> import sys
> import numarray
>
> data1=numarray.arange(4096*2, type=numarray.Float32)
> data2=numarray.arange(4096*2, type=numarray.Float32)
>
> while True:
>     print sys.getrefcount(None)
>     val=numarray.dot(data1, data2)
>
>
> I could trace this error down to the function NA_FromDimsStridesDescrAndData
> in numarray/Src/libnumarray.ch .
>
> The bug fix is:
> --- python-numarray-1.5.2/Src/libnumarray.ch    2006-08-24
> 20:38:15.000000000 +0200
> +++ /home/achim/libnumarray.ch  2006-11-19 21:14:52.000000000 +0100
> @@ -877,6 +877,7 @@
>                 if (!buf) return NULL;
>         } else {
>                 buf = Py_None;
> +               Py_INCREF(buf);
>         }
>
>         a = NA_NewAllFromBuffer( nd, dimensions, descr->type_num, buf,
>
> I think it is still worth fixing this bug. I've sent that bug report
> #399440 to Debian, too.
>
> Yours, Achim
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>   




More information about the NumPy-Discussion mailing list