Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c11514

Browse files
committed
Merge pull request #5080 from jkseppan/numpy16-gdk
BLD: Try to make backend_gdk compatible with numpy 1.6
2 parents 84f2fb7 + cb5afc8 commit 0c11514

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) = (PyObject *) py_pixbuf;
63+
#endif
5664
return PyArray_Return(array);
5765
}
5866

0 commit comments

Comments
 (0)