diff --git a/.gitignore b/.gitignore index c80f4b0..772df04 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,4 @@ numpy-1.4.1.tar.gz /numpy-1.20.0rc2.tar.gz /numpy-1.20.0.tar.gz /numpy-1.20.1.tar.gz +/numpy-1.21.1.tar.gz diff --git a/ad2a73c18d.patch b/ad2a73c18d.patch deleted file mode 100644 index 3ca84ec..0000000 --- a/ad2a73c18d.patch +++ /dev/null @@ -1,126 +0,0 @@ -From ad2a73c18dcff95d844c382c94ab7f73b5571cf3 Mon Sep 17 00:00:00 2001 -From: Sebastian Berg -Date: Tue, 4 May 2021 17:43:26 -0500 -Subject: [PATCH] MAINT: Adjust NumPy float hashing to Python's slightly - changed hash - -This is necessary, since we use the Python double hash and the -semi-private function to calculate it in Python has a new signature -to return the identity-hash when the value is NaN. - -closes gh-18833, gh-18907 ---- - numpy/core/src/common/npy_pycompat.h | 16 ++++++++++ - numpy/core/src/multiarray/scalartypes.c.src | 13 ++++---- - numpy/core/tests/test_scalarmath.py | 34 +++++++++++++++++++++ - 3 files changed, 57 insertions(+), 6 deletions(-) - -diff --git a/numpy/core/src/common/npy_pycompat.h b/numpy/core/src/common/npy_pycompat.h -index aa0b5c1224d3..9e94a971090a 100644 ---- a/numpy/core/src/common/npy_pycompat.h -+++ b/numpy/core/src/common/npy_pycompat.h -@@ -3,4 +3,20 @@ - - #include "numpy/npy_3kcompat.h" - -+ -+/* -+ * In Python 3.10a7 (or b1), python started using the identity for the hash -+ * when a value is NaN. See https://bugs.python.org/issue43475 -+ */ -+#if PY_VERSION_HEX > 0x030a00a6 -+#define Npy_HashDouble _Py_HashDouble -+#else -+static NPY_INLINE Py_hash_t -+Npy_HashDouble(PyObject *NPY_UNUSED(identity), double val) -+{ -+ return _Py_HashDouble(val); -+} -+#endif -+ -+ - #endif /* _NPY_COMPAT_H_ */ -diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src -index a001500b0a97..9930f7791d6e 100644 ---- a/numpy/core/src/multiarray/scalartypes.c.src -+++ b/numpy/core/src/multiarray/scalartypes.c.src -@@ -3172,7 +3172,7 @@ static npy_hash_t - static npy_hash_t - @lname@_arrtype_hash(PyObject *obj) - { -- return _Py_HashDouble((double) PyArrayScalar_VAL(obj, @name@)); -+ return Npy_HashDouble(obj, (double)PyArrayScalar_VAL(obj, @name@)); - } - - /* borrowed from complex_hash */ -@@ -3180,14 +3180,14 @@ static npy_hash_t - c@lname@_arrtype_hash(PyObject *obj) - { - npy_hash_t hashreal, hashimag, combined; -- hashreal = _Py_HashDouble((double) -- PyArrayScalar_VAL(obj, C@name@).real); -+ hashreal = Npy_HashDouble( -+ obj, (double)PyArrayScalar_VAL(obj, C@name@).real); - - if (hashreal == -1) { - return -1; - } -- hashimag = _Py_HashDouble((double) -- PyArrayScalar_VAL(obj, C@name@).imag); -+ hashimag = Npy_HashDouble( -+ obj, (double)PyArrayScalar_VAL(obj, C@name@).imag); - if (hashimag == -1) { - return -1; - } -@@ -3202,7 +3202,8 @@ c@lname@_arrtype_hash(PyObject *obj) - static npy_hash_t - half_arrtype_hash(PyObject *obj) - { -- return _Py_HashDouble(npy_half_to_double(PyArrayScalar_VAL(obj, Half))); -+ return Npy_HashDouble( -+ obj, npy_half_to_double(PyArrayScalar_VAL(obj, Half))); - } - - static npy_hash_t -diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py -index d91b4a39146d..09a734284a76 100644 ---- a/numpy/core/tests/test_scalarmath.py -+++ b/numpy/core/tests/test_scalarmath.py -@@ -707,3 +707,37 @@ - shift_arr = np.array([shift]*32, dtype=dt) - res_arr = op(val_arr, shift_arr) - assert_equal(res_arr, res_scl) -+ -+ -+class TestHash: -+ @pytest.mark.parametrize("type_code", np.typecodes['AllInteger']) -+ def test_integer_hashes(self, type_code): -+ scalar = np.dtype(type_code).type -+ for i in range(128): -+ assert hash(i) == hash(scalar(i)) -+ -+ @pytest.mark.parametrize("type_code", np.typecodes['AllFloat']) -+ def test_float_and_complex_hashes(self, type_code): -+ scalar = np.dtype(type_code).type -+ for val in [np.pi, np.inf, 3, 6.]: -+ numpy_val = scalar(val) -+ # Cast back to Python, in case the NumPy scalar has less precision -+ if numpy_val.dtype.kind == 'c': -+ val = complex(numpy_val) -+ else: -+ val = float(numpy_val) -+ assert val == numpy_val -+ print(repr(numpy_val), repr(val)) -+ assert hash(val) == hash(numpy_val) -+ -+ if hash(float(np.nan)) != hash(float(np.nan)): -+ # If Python distinguises different NaNs we do so too (gh-18833) -+ assert hash(scalar(np.nan)) != hash(scalar(np.nan)) -+ -+ @pytest.mark.parametrize("type_code", np.typecodes['Complex']) -+ def test_complex_hashes(self, type_code): -+ # Test some complex valued hashes specifically: -+ scalar = np.dtype(type_code).type -+ for val in [np.pi+1j, np.inf-3j, 3j, 6.+1j]: -+ numpy_val = scalar(val) -+ assert hash(complex(numpy_val)) == hash(numpy_val) diff --git a/d490589e01.patch b/d490589e01.patch deleted file mode 100644 index 4ab4f45..0000000 --- a/d490589e01.patch +++ /dev/null @@ -1,54 +0,0 @@ -From acf249e0c663f148ee6389327f0b35298fc14833 Mon Sep 17 00:00:00 2001 -From: Ralf Gommers -Date: Sat, 8 May 2021 14:52:03 +0200 -Subject: [PATCH] TST: xfail `TestCond.test_nan` unconditionally - -This is happening on too many build configurations, and it's not -completely clear if it's just an OpenBLAS version or also depends -on something else. Reported as happening mostly on macOS, but -also on Fedora. ---- - numpy/linalg/tests/test_linalg.py | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py -index 8a270f194147..c6e8cdd039f1 100644 ---- a/numpy/linalg/tests/test_linalg.py -+++ b/numpy/linalg/tests/test_linalg.py -@@ -684,7 +684,7 @@ def hermitian(mat): - axes = list(range(mat.ndim)) - axes[-1], axes[-2] = axes[-2], axes[-1] - return np.conj(np.transpose(mat, axes=axes)) -- -+ - assert_almost_equal(np.matmul(u, hermitian(u)), np.broadcast_to(np.eye(u.shape[-1]), u.shape)) - assert_almost_equal(np.matmul(vt, hermitian(vt)), np.broadcast_to(np.eye(vt.shape[-1]), vt.shape)) - assert_equal(np.sort(s)[..., ::-1], s) -@@ -766,6 +766,9 @@ def test_singular(self): - for A, p in itertools.product(As, p_neg): - linalg.cond(A, p) - -+ @pytest.mark.xfail(True, run=False, -+ reason="Platform/LAPACK-dependent failure, " -+ "see gh-18914") - def test_nan(self): - # nans should be passed through, not converted to infs - ps = [None, 1, -1, 2, -2, 'fro'] -@@ -981,7 +984,7 @@ def test_incompatible_dims(self): - linalg.lstsq(A, y, rcond=None) - - --@pytest.mark.parametrize('dt', [np.dtype(c) for c in '?bBhHiIqQefdgFDGO']) -+@pytest.mark.parametrize('dt', [np.dtype(c) for c in '?bBhHiIqQefdgFDGO']) - class TestMatrixPower: - - rshft_0 = np.eye(4) -@@ -1010,7 +1013,7 @@ def tz(M): - mz = matrix_power(M, 0) - assert_equal(mz, identity_like_generalized(M)) - assert_equal(mz.dtype, M.dtype) -- -+ - for mat in self.rshft_all: - tz(mat.astype(dt)) - if dt != object: diff --git a/numpy.spec b/numpy.spec index 156d108..32b0278 100644 --- a/numpy.spec +++ b/numpy.spec @@ -19,8 +19,8 @@ %global modname numpy Name: numpy -Version: 1.20.1 -Release: 5%{?dist} +Version: 1.21.1 +Release: 1%{?dist} Epoch: 1 Summary: A fast multidimensional array facility for Python @@ -30,16 +30,6 @@ URL: http://www.numpy.org/ Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: https://numpy.org/doc/1.19/numpy-html.zip -# Adjust NumPy float hashing to Python's slightly changed hash (Python 3.10.0b1+) -# Merged upstream, rebased slightly -# https://github.com/numpy/numpy/commit/ad2a73c18d.patch -Patch1: ad2a73c18d.patch - -# xfail TestCond.test_nan unconditionally -# it fails in many build configurations, including OpenBLAS 0.3.15 -# Merged upstream -Patch2: https://github.com/numpy/numpy/commit/d490589e01.patch - %description NumPy is a general-purpose array-processing package designed to efficiently manipulate large multi-dimensional arrays of arbitrary @@ -154,15 +144,15 @@ mkdir -p %{buildroot}%{_includedir} ln -s %{python3_sitearch}/%{name}/core/include/numpy/ %{buildroot}%{_includedir}/numpy -%check -%if %{with tests} -%ifarch ppc64le -# https://github.com/numpy/numpy/issues/14357 -python3 runtests.py -- -k 'not test_einsum_sums_cfloat64' -%else -python3 runtests.py -%endif -%endif +#%check Re-enable when .coveragerc is shipped: https://github.com/numpy/numpy/issues/19617 +#%if %{with tests} +#%ifarch ppc64le +## https://github.com/numpy/numpy/issues/14357 +#python3 runtests.py -- -k 'not test_einsum_sums_cfloat64' +#%else +#python3 runtests.py +#%endif +#%endif %files -n python3-numpy @@ -204,6 +194,9 @@ python3 runtests.py %changelog +* Thu Aug 05 2021 Gwyn Ciesla - 1:1.21.1-1 +- 1.21.1, disabing tests as they depend on .coveragerc, not shipped. + * Thu Jul 22 2021 Fedora Release Engineering - 1:1.20.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 2780c52..408e961 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (numpy-1.20.1.tar.gz) = e6b55e04549af7539e9dab342c1b2cb6ecdb5f577d4f415c05d4048e228e78215d5dec544743839536f205737c290fa53455cc535b171fd7447c911e1a497791 +SHA512 (numpy-1.21.1.tar.gz) = 4ddfdc1c430a885714be966a213c10cd5e171e8d5fc03823ef85c24043f8e79865129b64abf27358d8acc4977fcddb3ba7f9ddc8fc01aac8d579eff476a0c268 SHA512 (numpy-html.zip) = 4a421636523424a0703290b6a0ba53b85a9a9e8a6256363e2481f1c02ae278825c09f2f13d39e99f8aae21f57a4978723f3fc690693520f8c3b45a5b4c5a38ab