Skip to content

Commit 4ab9919

Browse files
committed
Try to make backend_gdk compatible with numpy 1.6
1 parent 6c83304 commit 4ab9919

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/_backend_gdk.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ static PyObject *pixbuf_get_pixels_array(PyObject *self, PyObject *args)
5252

5353
/* the array holds a ref to the pixbuf pixels through this wrapper*/
5454
Py_INCREF(py_pixbuf);
55-
PyArray_SetBaseObject(array, (PyObject *)py_pixbuf);
55+
#if NPY_API_VERSION >= 0x00000007
56+
if (PyArray_SetBaseObject(array, (PyObject *)py_pixbuf) == -1) {
57+
Py_DECREF(py_pixbuf);
58+
Py_DECREF(array);
59+
return NULL;
60+
}
61+
#else
62+
PyArray_BASE(array) = py_pixbuf;
63+
#endif
5664
return PyArray_Return(array);
5765
}
5866

0 commit comments

Comments
 (0)