Merge #244250: python3Packages.numpy: fix failing tests and clang 16
...into staging-next
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchPypi
|
||||
, fetchpatch
|
||||
, python
|
||||
, buildPythonPackage
|
||||
, gfortran
|
||||
@@ -37,7 +39,7 @@ let
|
||||
};
|
||||
};
|
||||
};
|
||||
in buildPythonPackage rec {
|
||||
in buildPythonPackage (rec {
|
||||
pname = "numpy";
|
||||
version = "1.24.2";
|
||||
format = "setuptools";
|
||||
@@ -54,6 +56,28 @@ in buildPythonPackage rec {
|
||||
# Patching of numpy.distutils is needed to prevent it from undoing the
|
||||
# patch to distutils.
|
||||
./numpy-distutils-C++.patch
|
||||
]
|
||||
++ lib.optionals stdenv.cc.isClang [
|
||||
# f2py.f90mod_rules generates code with invalid function pointer conversions, which are
|
||||
# clang 16 makes an error by default.
|
||||
(fetchpatch {
|
||||
url = "https://github.com/numpy/numpy/commit/609fee4324f3521d81a3454f5fcc33abb0d3761e.patch";
|
||||
hash = "sha256-6Dbmf/RWvQJPTIjvchVaywHGcKCsgap/0wAp5WswuCo=";
|
||||
})
|
||||
]
|
||||
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
# Backport from 1.25. `platform.machine` returns `arm64` on aarch64-darwin, which causes
|
||||
# differing results between `_selected_real_kind_func` and Fortran’s `selected_real_kind`.
|
||||
(fetchpatch {
|
||||
url = "https://github.com/numpy/numpy/commit/afcedf4b63f4a94187e6995c2adea0da3bb18e83.patch";
|
||||
hash = "sha256-cxBoimX5a9wC2qUIGAo5o/M2E9+eV63bV2/wLmfDYKg=";
|
||||
})
|
||||
]
|
||||
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
||||
# Disable `numpy/core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex256]`
|
||||
# on x86_64-darwin because it fails under Rosetta 2 due to issues with trig functions and
|
||||
# 80-bit long double complex numbers.
|
||||
./disable-failing-long-double-test-Rosetta-2.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
@@ -113,4 +137,7 @@ in buildPythonPackage rec {
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ fridh ];
|
||||
};
|
||||
}
|
||||
} // lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Causes `error: argument unused during compilation: '-fno-strict-overflow'` due to `-Werror`.
|
||||
hardeningDisable = [ "strictoverflow" ];
|
||||
})
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
|
||||
index 6951d41e4..eefe86ad4 100644
|
||||
--- a/numpy/core/tests/test_umath.py
|
||||
+++ b/numpy/core/tests/test_umath.py
|
||||
@@ -4180,7 +4180,17 @@ def test_against_cmath(self):
|
||||
)
|
||||
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
|
||||
@pytest.mark.xfail(IS_WASM, reason="doesn't work")
|
||||
- @pytest.mark.parametrize('dtype', [np.complex64, np.complex_, np.longcomplex])
|
||||
+ @pytest.mark.parametrize('dtype', [
|
||||
+ np.complex64,
|
||||
+ np.complex_,
|
||||
+ pytest.param(
|
||||
+ np.longcomplex,
|
||||
+ marks=pytest.mark.skipif(
|
||||
+ sys.platform == "darwin" and platform.machine() == "x86_64",
|
||||
+ reason="doesn’t work under Rosetta 2",
|
||||
+ ),
|
||||
+ ),
|
||||
+ ])
|
||||
def test_loss_of_precision(self, dtype):
|
||||
"""Check loss of precision in complex arc* functions"""
|
||||
|
||||
Reference in New Issue
Block a user