Backport patches for NumPy 2.x
Fix build error since upgrade to NumPy 2.x.
This commit is contained in:
parent
0d18786666
commit
3cc264041a
2 changed files with 59 additions and 1 deletions
51
boost-1.83-NumPy-2.x-dtype.patch
Normal file
51
boost-1.83-NumPy-2.x-dtype.patch
Normal file
|
|
@ -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<PyObject*>(obj));
|
||||
}
|
||||
|
||||
-int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(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<long>() || a == dtype::get_builtin<int>()) &&
|
||||
- (b == dtype::get_builtin<long>() || b == dtype::get_builtin<int>()) ||
|
||||
- (a == dtype::get_builtin<unsigned int>() || a == dtype::get_builtin<unsigned long>()) &&
|
||||
- (b == dtype::get_builtin<unsigned int>() || b == dtype::get_builtin<unsigned long>()))) {
|
||||
- return true;
|
||||
- } else {
|
||||
- return PyArray_EquivTypes(
|
||||
- reinterpret_cast<PyArray_Descr*>(a.ptr()),
|
||||
- reinterpret_cast<PyArray_Descr*>(b.ptr())
|
||||
- );
|
||||
- }
|
||||
+int dtype::get_itemsize() const {
|
||||
+#if NPY_ABI_VERSION < 0x02000000
|
||||
+ return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;
|
||||
#else
|
||||
- return PyArray_EquivTypes(
|
||||
- reinterpret_cast<PyArray_Descr*>(a.ptr()),
|
||||
- reinterpret_cast<PyArray_Descr*>(b.ptr())
|
||||
- );
|
||||
+ return PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()));
|
||||
#endif
|
||||
}
|
||||
|
||||
+bool equivalent(dtype const & a, dtype const & b) {
|
||||
+ return a == b;
|
||||
+}
|
||||
+
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
@ -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 <devel@penguinpee.nl> - 1.83.0-10
|
||||
- Backport patches for NumPy 2.x
|
||||
|
||||
* Fri Dec 06 2024 Pete Walter <pwalter@fedoraproject.org> - 1.83.0-9
|
||||
- Rebuild for ICU 76
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue