Commit 5e933a2f authored by Stefan Behnel's avatar Stefan Behnel

cleanup

parent 5190f6bd
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
DEF _buffer_format_string_len = 255 DEF _buffer_format_string_len = 255
cimport python_buffer as pybuf 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 stdlib
cimport stdio cimport stdio
...@@ -903,23 +903,21 @@ cdef extern from "numpy/ufuncobject.h": ...@@ -903,23 +903,21 @@ cdef extern from "numpy/ufuncobject.h":
(PyUFuncGenericFunction *, void **, char *, int, int, int, (PyUFuncGenericFunction *, void **, char *, int, int, int,
int, char *, char *, int, char *) int, char *, char *, int, char *)
void import_ufunc() void import_ufunc()
cdef inline void set_array_base(ndarray arr, object base): cdef inline void set_array_base(ndarray arr, object base):
cdef PyObject* baseptr cdef PyObject* baseptr
cdef ndarray raw = arr
if base is None: if base is None:
baseptr = NULL baseptr = NULL
else: else:
Py_INCREF(base) # important to do this before decref below!
baseptr = <PyObject*>base baseptr = <PyObject*>base
Py_XINCREF(baseptr) # important to do this before decref below! Py_XDECREF(arr.base)
Py_XDECREF(raw.base) arr.base = baseptr
raw.base = baseptr
cdef inline object get_array_base(ndarray arr): cdef inline object get_array_base(ndarray arr):
cdef ndarray raw = arr if arr.base is NULL:
if raw.base == NULL:
return None return None
else: else:
return <object>raw.base return <object>arr.base
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment