diff --git a/boost-1.83-NumPy-2.x-dtype.patch b/boost-1.83-NumPy-2.x-dtype.patch new file mode 100644 index 0000000..20fba56 --- /dev/null +++ b/boost-1.83-NumPy-2.x-dtype.patch @@ -0,0 +1,51 @@ +Submodule libs/python 47d5bc76f6..8d15ce0517: +diff --git a/libs/python/src/numpy/dtype.cpp b/libs/python/src/numpy/dtype.cpp +index 88a20a27..1ce8c6ec 100644 +--- a/libs/python/src/numpy/dtype.cpp ++++ b/libs/python/src/numpy/dtype.cpp +@@ -98,37 +98,18 @@ 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;} +- +-bool equivalent(dtype const & a, dtype const & b) { +- // On Windows x64, the behaviour described on +- // http://docs.scipy.org/doc/numpy/reference/c-api.array.html for +- // PyArray_EquivTypes unfortunately does not extend as expected: +- // "For example, on 32-bit platforms, NPY_LONG and NPY_INT are equivalent". +- // This should also hold for 64-bit platforms (and does on Linux), but not +- // on Windows. Implement an alternative: +-#ifdef _MSC_VER +- if (sizeof(long) == sizeof(int) && +- // Manually take care of the type equivalence. +- ((a == dtype::get_builtin() || a == dtype::get_builtin()) && +- (b == dtype::get_builtin() || b == dtype::get_builtin()) || +- (a == dtype::get_builtin() || a == dtype::get_builtin()) && +- (b == dtype::get_builtin() || b == dtype::get_builtin()))) { +- return true; +- } else { +- return PyArray_EquivTypes( +- reinterpret_cast(a.ptr()), +- reinterpret_cast(b.ptr()) +- ); +- } ++int dtype::get_itemsize() const { ++#if NPY_ABI_VERSION < 0x02000000 ++ return reinterpret_cast(ptr())->elsize; + #else +- return PyArray_EquivTypes( +- reinterpret_cast(a.ptr()), +- reinterpret_cast(b.ptr()) +- ); ++ return PyDataType_ELSIZE(reinterpret_cast(ptr())); + #endif + } + ++bool equivalent(dtype const & a, dtype const & b) { ++ return a == b; ++} ++ + namespace + { + diff --git a/boost.spec b/boost.spec index 3665ded..51abe6c 100644 --- a/boost.spec +++ b/boost.spec @@ -46,7 +46,7 @@ Name: boost %global real_name boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.83.0 -Release: 9%{?dist} +Release: 10%{?dist} License: BSL-1.0 AND MIT AND Python-2.0.1 # Replace each . with _ in %%{version} @@ -172,6 +172,10 @@ Patch10: boost-1.83-math-Correct-float_next-INF-and-float_prior-INF.patch # https://github.com/boostorg/context/pull/234 Patch11: boost-1.83-Fix-ABI-detection-for-empty-os-platform.patch +# https://github.com/boostorg/python/pull/432 +# https://github.com/boostorg/python/pull/443 +Patch12: boost-1.83-NumPy-2.x-dtype.patch + %bcond_with tests %bcond_with docs_generated @@ -1312,6 +1316,9 @@ fi %{_mandir}/man1/b2.1* %changelog +* Tue Dec 24 2024 Sandro - 1.83.0-10 +- Backport patches for NumPy 2.x + * Fri Dec 06 2024 Pete Walter - 1.83.0-9 - Rebuild for ICU 76