From: Dag Sverre Seljebotn Date: Mon, 10 Nov 2008 13:13:36 +0000 (+0100) Subject: Fix segfault problem with recent numpy.pxd/Python 2.4 patch X-Git-Tag: 0.10.1~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=05e744dce30dfaf29ea6baff491f43ee0ad52221;p=cython.git Fix segfault problem with recent numpy.pxd/Python 2.4 patch --- diff --git a/Cython/Includes/numpy.pxd b/Cython/Includes/numpy.pxd index 5b86a6fc..3049ae53 100644 --- a/Cython/Includes/numpy.pxd +++ b/Cython/Includes/numpy.pxd @@ -187,7 +187,8 @@ cdef extern from "numpy/arrayobject.h": def __releasebuffer__(ndarray self, Py_buffer* info): # This can not be called unless format needs to be freed (as # obj is set to NULL in those case) - stdlib.free(info.format) + if PyArray_HASFIELDS(self): + stdlib.free(info.format) if sizeof(npy_intp) != sizeof(Py_ssize_t): stdlib.free(info.strides) # info.shape was stored after info.strides in the same block @@ -201,7 +202,7 @@ cdef extern from "numpy/arrayobject.h": cdef npy_intp* PyArray_DIMS(ndarray arr) cdef int PyArray_ITEMSIZE(ndarray arr) cdef int PyArray_CHKFLAGS(ndarray arr, int flags) - cdef int PyArray_HASFIELDS(ndarray arr, int flags) + cdef int PyArray_HASFIELDS(ndarray arr) cdef int PyDataType_HASFIELDS(dtype obj)