From af3d0b491e4c2e13b1fb7ac83fd1b19aaf84ac54 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Wed, 5 Jul 2023 16:15:40 -0400 Subject: [PATCH] Fix FTBFS with Python 3.12 --- ...2b858e2e6ebc394e95c81a024dcf1573c690.patch | 46 +++++++++++++++++++ numpy.spec | 6 ++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 b0872b858e2e6ebc394e95c81a024dcf1573c690.patch diff --git a/b0872b858e2e6ebc394e95c81a024dcf1573c690.patch b/b0872b858e2e6ebc394e95c81a024dcf1573c690.patch new file mode 100644 index 0000000..2c328d2 --- /dev/null +++ b/b0872b858e2e6ebc394e95c81a024dcf1573c690.patch @@ -0,0 +1,46 @@ +From b0872b858e2e6ebc394e95c81a024dcf1573c690 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +Date: Mon, 19 Jun 2023 11:07:19 +0200 +Subject: [PATCH] TST: skip refcount related tests on py312 + +Python 3.12 has immortal refcounts; the initial and final +values will be the same when accessing `sys.getrefcount` inside a +test. + +Closes gh-23986 +--- + numpy/core/tests/test_dtype.py | 5 +++++ + numpy/core/tests/test_regression.py | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py +index 454bcfa7cc1..9c88ddb5cd7 100644 +--- a/numpy/core/tests/test_dtype.py ++++ b/numpy/core/tests/test_dtype.py +@@ -755,6 +755,11 @@ def iter_struct_object_dtypes(): + yield pytest.param(dt, p, 12, obj, id="") + + ++@pytest.mark.skipif( ++ sys.version_info >= (3, 12), ++ reason="Python 3.12 has immortal refcounts, this test will no longer " ++ "work. See gh-23986" ++) + @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") + class TestStructuredObjectRefcounting: + """These tests cover various uses of complicated structured types which +diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py +index e415ecccf9f..35763f843da 100644 +--- a/numpy/core/tests/test_regression.py ++++ b/numpy/core/tests/test_regression.py +@@ -1465,6 +1465,10 @@ def test_structured_arrays_with_objects1(self): + x[x.nonzero()] = x.ravel()[:1] + assert_(x[0, 1] == x[0, 0]) + ++ @pytest.mark.skipif( ++ sys.version_info >= (3, 12), ++ reason="Python 3.12 has immortal refcounts, this test no longer works." ++ ) + @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") + def test_structured_arrays_with_objects2(self): + # Ticket #1299 second test diff --git a/numpy.spec b/numpy.spec index 8e97532..5fd385c 100644 --- a/numpy.spec +++ b/numpy.spec @@ -20,7 +20,7 @@ Name: numpy Version: 1.24.3 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 Summary: A fast multidimensional array facility for Python @@ -29,6 +29,7 @@ License: BSD-3-Clause AND Apache-2.0 URL: http://www.numpy.org/ Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: https://numpy.org/doc/%(echo %{version} | cut -d. -f1-2)/numpy-html.zip +Patch0: https://github.com/numpy/numpy/commit/b0872b858e2e6ebc394e95c81a024dcf1573c690.patch %description NumPy is a general-purpose array-processing package designed to @@ -210,6 +211,9 @@ python3 runtests.py --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{ %changelog +* Wed Jul 05 2023 Scott Talbert - 1:1.24.3-4 +- Fix FTBFS with Python 3.12 + * Fri Jun 16 2023 Python Maint - 1:1.24.3-3 - Rebuilt for Python 3.12