Skip to content

Commit

Permalink
Support numpy 2.0.0b1
Browse files Browse the repository at this point in the history
  • Loading branch information
duburcqa authored and stefanseefeld committed May 6, 2024
1 parent 6c3f3ec commit 0474de0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/numpy/dtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ python::detail::new_reference dtype::convert(object const & arg, bool align)
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
}

int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
int dtype::get_itemsize() const {
#if NPY_ABI_VERSION < 0x02000000
return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;
#else
return PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()));
#endif
}

bool equivalent(dtype const & a, dtype const & b) {
// On Windows x64, the behaviour described on
Expand Down

0 comments on commit 0474de0

Please sign in to comment.