[Numpy-discussion] segfault caused by incorrect Py_DECREF in ufunc
tom.denniston at alum.dartmouth.org
Fri Jul 6 19:40:28 EDT 2007
On 7/6/07, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> Tom Denniston wrote:
> >Below is the code around line 900 for ufuncobject.c
> >There is a decref labeled with ">>>" below that is incorrect. As per
> >the python documentation
> >#PyObject* PyDict_GetItem( PyObject *p, PyObject *key)
> >#Return value: Borrowed reference.
> >#Return the object from dictionary p which has a key key. Return NULL
> >if the key #key is not present, but without setting an exception.
> >PyDict_GetItem returns a borrowed reference. Therefore this code does
> >not own the contents to which the obj pointer points and should not
> >decref on it. Simply removing the Py_DECREF(obj) line gets rid of the
> >I was wondering if someone could confirm that my interpretation is
> >correct and remove the line. I don't have access to the svn or know
> >how to change it.
> >Most people do not see this problem because it only affects user defined types.
> You are right on with your analysis. Thank you for the test, check, and
> I've changed it in SVN.
> Best regards,
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
More information about the NumPy-Discussion