Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another patch for numpy 2.0 (main branch) #212

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ source:
url: https://boostorg.jfrog.io/artifactory/main/release/{{ version }}/source/boost_{{ version|replace(".", "_") }}.tar.bz2
sha256: 7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617
patches:
# ensure our compiler flags get used during bootstrapping
# ensure our compiler flags get used during bootstrapping
- patches/0001-Add-default-value-for-cxx-and-cxxflags-options-for-t.patch
# backport https://github.com/boostorg/charconv/pull/183
- patches/0002-Merge-pull-request-183-from-boostorg-ppc64le.patch
# backport https://github.com/boostorg/python/pull/432
- patches/0003-Support-numpy-2.0.0b1.patch
# backport https://github.com/boostorg/python/pull/443
- patches/0004-Support-numpy-2.0.patch

build:
number: 3
bkpoon marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
38 changes: 38 additions & 0 deletions recipe/patches/0004-Support-numpy-2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/libs/python/src/numpy/dtype.cpp b/libs/python/src/numpy/dtype.cpp
index da30d192..1ce8c6ec 100644
--- a/libs/python/src/numpy/dtype.cpp
+++ b/libs/python/src/numpy/dtype.cpp
@@ -107,32 +107,7 @@ int dtype::get_itemsize() const {
}

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())
- );
- }
-#else
- return PyArray_EquivTypes(
- reinterpret_cast<PyArray_Descr*>(a.ptr()),
- reinterpret_cast<PyArray_Descr*>(b.ptr())
- );
-#endif
+ return a == b;
}

namespace