Skip to content

Commit

Permalink
fix(python/ext): fix building with NumPy<2
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms committed Jul 23, 2024
1 parent 997afee commit a8e6b49
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/ext/src/_neuroglancer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ static int tp_init(Obj* self, PyObject* args, PyObject* kwds) {
return -1;
}
auto* descr = PyArray_DESCR(array);
npy_intp elsize = PyDataType_ELSIZE(descr);
npy_intp elsize;
#ifdef NPY_2_0_API_VERSION
elsize = PyDataType_ELSIZE(descr);
#else
elsize = descr->elsize;
#endif
if ((descr->kind != 'i' && descr->kind != 'u') ||
(elsize != 1 && elsize != 2 && elsize != 4 && elsize != 8)) {
Py_DECREF(array);
Expand Down

0 comments on commit a8e6b49

Please sign in to comment.