https://bugs.gentoo.org/932459 https://github.com/boostorg/python/issues/431 https://github.com/boostorg/python/pull/432 From 33ac06ca59a68266d3d26edf08205d31ddab4a6c Mon Sep 17 00:00:00 2001 From: Alexis DUBURCQ Date: Fri, 15 Mar 2024 14:10:16 +0100 Subject: [PATCH] Support numpy 2.0.0b1 --- libs/python/src/numpy/dtype.cpp +++ libs/python/src/numpy/dtype.cpp @@ -98,7 +98,13 @@ python::detail::new_reference dtype::convert(object const & arg, bool align) return python::detail::new_reference(reinterpret_cast(obj)); } -int dtype::get_itemsize() const { return reinterpret_cast(ptr())->elsize;} +int dtype::get_itemsize() const { +#if NPY_ABI_VERSION < 0x02000000 + return reinterpret_cast(ptr())->elsize; +#else + return PyDataType_ELSIZE(reinterpret_cast(ptr())); +#endif +} bool equivalent(dtype const & a, dtype const & b) { // On Windows x64, the behaviour described on