[Numpy-discussion] Bug in numpy user-define types mechanism causes segfault on multiple calls to a ufunc

Travis Oliphant oliphant@ee.byu....
Wed Feb 7 17:29:31 CST 2007


Tom Denniston wrote:

>I am trying to register a custom type to numpy.  When I do so it works
>and the ufuncs work but then when I invoke any ufunc twice the second
>time my python interpretter segfaults.  I think i know what the
>problem is.  In the select_types method in ufuncobject.c in
>numpy/core/src/ numpy gets a reference to the key for the loop via a
>  
>
Thank you very much for your review of this less-used code.

>If I comment out the obj DECREF it works.  I think one needs to either
>do that or add an INCREF right after retrieving key.  I think either
>will work but the multithreading implications are different.  I don't
>think it matters give that (I believe) numpy doesn't release the GIL
>but I thought someone on this list would be a better judge than I
>(maybe Travis) of what the correct fix should be.
>
>Am I correct in my analysis?
>  
>

Your analysis seems spot on.  I think removing the  is the right course 
of action.   I've done it in SVN.



-Travis



More information about the Numpy-discussion mailing list