diff -Nrup a/src/ndimg/nd_image.c b/src/ndimg/nd_image.c --- a/src/ndimg/nd_image.c 2019-07-20 20:14:12.000000000 +0200 +++ b/src/ndimg/nd_image.c 2023-03-13 20:54:59.211037022 +0100 @@ -39,6 +39,12 @@ #include "ni_interpolation.h" #include "ni_measure.h" +/* uses the old numpy API since it sets the data attribute */ +#ifdef NPY_NO_DEPRECATED_API +#undef NPY_NO_DEPRECATED_API +#endif +#define NPY_NO_DEPRECATED_API 0 + typedef struct { PyObject *function; PyObject *extra_arguments; diff -Nrup a/src/ndimg/nd_image.h b/src/ndimg/nd_image.h --- a/src/ndimg/nd_image.h 2019-07-20 20:14:12.000000000 +0200 +++ b/src/ndimg/nd_image.h 2023-03-13 21:03:58.888045307 +0100 @@ -42,6 +42,12 @@ #include <numpy/noprefix.h> #undef NO_IMPORT_ARRAY +/* uses the old numpy API since it sets the data attribute */ +#ifdef NPY_NO_DEPRECATED_API +#undef NPY_NO_DEPRECATED_API +#endif +#define NPY_NO_DEPRECATED_API 0 + /* Eventually get rid of everything below this line */ typedef enum @@ -137,7 +143,7 @@ NA_OutputArray(PyObject *a, NumarrayType } ret = (PyArrayObject *)PyArray_Empty(PyArray_NDIM(a), PyArray_DIMS(a), dtype, 0); - ret->flags |= NPY_UPDATEIFCOPY; + ret->flags |= NPY_ITER_UPDATEIFCOPY; ret->base = a; PyArray_FLAGS(a) &= ~NPY_WRITEABLE; Py_INCREF(a); @@ -155,7 +161,7 @@ copy from the temporary back to the orig static PyArrayObject * NA_IoArray(PyObject *a, NumarrayType t, int requires) { - PyArrayObject *shadow = NA_InputArray(a, t, requires | NPY_UPDATEIFCOPY ); + PyArrayObject *shadow = NA_InputArray(a, t, requires | NPY_ITER_UPDATEIFCOPY ); if (!shadow) return NULL; @@ -165,7 +171,7 @@ NA_IoArray(PyObject *a, NumarrayType t, if (!PyArray_ISWRITEABLE(shadow)) { PyErr_Format(PyExc_TypeError, "NA_IoArray: I/O array must be writable array"); - PyArray_XDECREF_ERR(shadow); + PyArray_XDECREF(shadow); return NULL; }