MINGW-packages/mingw-w64-boost/0011-support-numpy-2.patch
مهدي شينون (Mehdi Chinoune) fd809aec6c rebuild packages against numpy-2.0.0
2024-08-01 17:35:38 +01:00

18 lines
589 B
Diff

--- a/libs/python/src/numpy/dtype.cpp
+++ b/libs/python/src/numpy/dtype.cpp
@@ -98,7 +98,13 @@
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