Skip to content

Commit 5939ed6

Browse files
authored
Merge pull request #7 from tango-controls/update-boost185-numpy2
Update boost to 1.85.0, with NumPy 2 support (patched)
2 parents f6e23c0 + 1886235 commit 5939ed6

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

appveyor.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 1.0.{build}
22

33
environment:
4-
BOOST_VERSION: "1.83.0"
5-
BOOST_VERSION_UNDERSCORED: "1_83_0"
4+
BOOST_VERSION: "1.85.0"
5+
BOOST_VERSION_UNDERSCORED: "1_85_0"
66
matrix:
77
# Python 3.9
88
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
@@ -119,6 +119,8 @@ install:
119119
120120
Write-Host "Installed Python $($env:PY_VER) to $($env:PYTHONPATH)" -ForegroundColor Green
121121
}
122+
# apply patches to Boost
123+
- cmd: patch -uN C:/projects/boost_build/boost_%BOOST_VERSION_UNDERSCORED%/libs/python/src/numpy/dtype.cpp C:/projects/boost-ci/patches/support-numpy-2.0.0b1.patch
122124
# building bootstrap
123125
- cmd: cd C:/projects/boost_build/boost_%BOOST_VERSION_UNDERSCORED%
124126
- cmd: C:/projects/boost_build/boost_%BOOST_VERSION_UNDERSCORED%/bootstrap.bat

patches/support-numpy-2.0.0b1.patch

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 8ac13ee041e575a5b2af196dfd5088d9bdf90700 Mon Sep 17 00:00:00 2001
2+
From: Alexis DUBURCQ <[email protected]>
3+
Date: Fri, 15 Mar 2024 14:10:16 +0100
4+
Subject: [PATCH] Support numpy 2.0.0b1
5+
6+
---
7+
libs/python/libs/python/src/numpy/dtype.cpp | 8 +++++++-
8+
1 file changed, 7 insertions(+), 1 deletion(-)
9+
10+
diff --git a/libs/python/src/numpy/dtype.cpp b/libs/python/src/numpy/dtype.cpp
11+
index 88a20a27..da30d192 100644
12+
--- a/libs/python/src/numpy/dtype.cpp
13+
+++ b/libs/python/src/numpy/dtype.cpp
14+
@@ -98,7 +98,13 @@ python::detail::new_reference dtype::convert(object const & arg, bool align)
15+
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
16+
}
17+
18+
-int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
19+
+int dtype::get_itemsize() const {
20+
+#if NPY_ABI_VERSION < 0x02000000
21+
+ return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;
22+
+#else
23+
+ return PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()));
24+
+#endif
25+
+}
26+
27+
bool equivalent(dtype const & a, dtype const & b) {
28+
// On Windows x64, the behaviour described on

0 commit comments

Comments
 (0)