From: Stefan Behnel Date: Thu, 15 Oct 2009 14:58:31 +0000 (+0200) Subject: cleanup X-Git-Tag: 0.13.beta0~2^2~121^2~42 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5e933a2fb2bebbe60c9a23046c8fc0f542f195f8;p=cython.git cleanup --- diff --git a/Cython/Includes/numpy.pxd b/Cython/Includes/numpy.pxd index 35fba02b..3f6c602f 100644 --- a/Cython/Includes/numpy.pxd +++ b/Cython/Includes/numpy.pxd @@ -17,7 +17,7 @@ DEF _buffer_format_string_len = 255 cimport python_buffer as pybuf -from python_ref cimport PyObject, Py_XINCREF, Py_XDECREF +from python_ref cimport PyObject, Py_INCREF, Py_XDECREF cimport stdlib cimport stdio @@ -903,23 +903,21 @@ cdef extern from "numpy/ufuncobject.h": (PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int, char *) - void import_ufunc() + cdef inline void set_array_base(ndarray arr, object base): cdef PyObject* baseptr - cdef ndarray raw = arr if base is None: baseptr = NULL else: + Py_INCREF(base) # important to do this before decref below! baseptr = base - Py_XINCREF(baseptr) # important to do this before decref below! - Py_XDECREF(raw.base) - raw.base = baseptr + Py_XDECREF(arr.base) + arr.base = baseptr cdef inline object get_array_base(ndarray arr): - cdef ndarray raw = arr - if raw.base == NULL: + if arr.base is NULL: return None else: - return raw.base + return arr.base