diff --git a/src/boost/libs/python/src/numpy/dtype.cpp b/src/boost/libs/python/src/numpy/dtype.cpp index 88a20a27b5..da30d1927b 100644 --- a/src/boost/libs/python/src/numpy/dtype.cpp +++ b/src/boost/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