[Numpy-discussion] Vectorize bug

Travis Oliphant oliphant.travis at ieee.org
Fri Apr 14 18:47:01 CDT 2006

Albert Strasheim wrote:
> Hello all
> I think Valgrind might be very useful in tracking down this bug.
> http://valgrind.org/
> Example usage:
> ~/bin/valgrind \
> 	-v --error-limit=no --leak-check=full \ 
> 	python -c 'import numpy; numpy.test()'
> Valgrind emits many warnings for things going on inside Python on my Fedora
> Core 4 system, but there is also a lot of interesting things going on in the
> NumPy code.
> Some warnings that someone might want to look at:
> ==26750== Use of uninitialised value of size 4
> ==26750==    at 0x453D4B1: DOUBLE_to_OBJECT (arraytypes.inc:4470)
> ==26750==    by 0x46AB3F3: PyUFunc_GenericFunction (ufuncobject.c:1566)
> ==26750==    by 0x46ABE9F: ufunc_generic_call (ufuncobject.c:2653)
I think this may be the culprit.   The buffer was not being initialized 
to NULL and so DECREF was being called on whatever was there.  This can 
produce strange results indeed depending on the environment.

I've initialized the buffer now for loops involving OBJECTs (this same 
error has happened a couple of times as it's one of the big ones for 
object arrays).   I thought I fixed all places where it might occur, but 
apparently not...

Perhaps you could try the code again.

More information about the Numpy-discussion mailing list