2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Support numpy 2.0.0b1

This commit is contained in:
Alexis DUBURCQ
2024-03-15 14:10:16 +01:00
committed by Stefan Seefeld
parent 6c3f3ecacf
commit 0474de0f6c

View File

@@ -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