commit: 598a530efd89c78a4a079895e362b1db6a4cf54d Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Jun 26 12:48:09 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Jun 26 13:14:16 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=598a530e
dev-python/numpy: enable py3.12 It turns out the test failures were non-issues and are now fixed upstream. Closes: https://bugs.gentoo.org/907309 Signed-off-by: Sam James <sam <AT> gentoo.org> ...y-1.25.0-skip-python3.12-irrelevant-tests.patch | 187 +++++++++++++++++++++ dev-python/numpy/numpy-1.25.0.ebuild | 3 +- 2 files changed, 189 insertions(+), 1 deletion(-) diff --git a/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch b/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch new file mode 100644 index 000000000000..cd829c5ef08e --- /dev/null +++ b/dev-python/numpy/files/numpy-1.25.0-skip-python3.12-irrelevant-tests.patch @@ -0,0 +1,187 @@ +https://github.com/numpy/numpy/commit/515403f2c637cb58f8dc326d88dd6f768f027cf4 +https://github.com/numpy/numpy/commit/b0872b858e2e6ebc394e95c81a024dcf1573c690 +https://github.com/numpy/numpy/commit/e42fc93b54a6d41dab72d86921f96e5ebc4c4198 +https://github.com/numpy/numpy/commit/4552b6cb0083502f731794e961cd30b9b62ba2e3 + +From 515403f2c637cb58f8dc326d88dd6f768f027cf4 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers <ralf.gomm...@gmail.com> +Date: Sun, 18 Jun 2023 15:56:23 +0200 +Subject: [PATCH] TST: disable `test_new_policy` test for memory allocator. + +This is way too slow, running a large part of the test suite twice. +Issue 23975 tracks changing how this feature is tested. +--- + numpy/core/tests/test_mem_policy.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numpy/core/tests/test_mem_policy.py b/numpy/core/tests/test_mem_policy.py +index b4e2f65916c..0855d60771a 100644 +--- a/numpy/core/tests/test_mem_policy.py ++++ b/numpy/core/tests/test_mem_policy.py +@@ -359,7 +359,7 @@ def test_thread_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + +-@pytest.mark.slow ++@pytest.mark.skip(reason="too slow, see gh-23975") + def test_new_policy(get_module): + a = np.arange(10) + orig_policy_name = np.core.multiarray.get_handler_name(a) + +From b0872b858e2e6ebc394e95c81a024dcf1573c690 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers <ralf.gomm...@gmail.com> +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 +--- 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="<structured subarray 2>") + + ++@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 +--- 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 + +From e42fc93b54a6d41dab72d86921f96e5ebc4c4198 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers <ralf.gomm...@gmail.com> +Date: Mon, 19 Jun 2023 11:14:38 +0200 +Subject: [PATCH] TST: skip memory allocator and `array_interface` tests on + py312 + +They require numpy.distutils, which isn't available on >=3.12 +The `numpy.testing.extbuild` utility will need changing to make this +work again. Could either use plain `setuptools` or `meson`. +--- a/numpy/core/tests/test_array_interface.py ++++ b/numpy/core/tests/test_array_interface.py +@@ -128,6 +128,9 @@ def get_module(tmp_path): + more_init=more_init) + + ++# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on ++# Python 3.12 and up. ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.slow + def test_cstruct(get_module): + +--- a/numpy/core/tests/test_mem_policy.py ++++ b/numpy/core/tests/test_mem_policy.py +@@ -9,6 +9,11 @@ + import sys + + ++# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on ++# Python 3.12 and up. It's an internal test utility, so for now we just skip ++# these tests. ++ ++ + @pytest.fixture + def get_module(tmp_path): + """ Add a memory policy that returns a false pointer 64 bytes into the +@@ -213,6 +218,7 @@ def get_module(tmp_path): + more_init=more_init) + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_set_policy(get_module): + + get_handler_name = np.core.multiarray.get_handler_name +@@ -241,6 +247,7 @@ def test_set_policy(get_module): + assert get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_default_policy_singleton(get_module): + get_handler_name = np.core.multiarray.get_handler_name + +@@ -262,6 +269,7 @@ def test_default_policy_singleton(get_module): + assert def_policy_1 is def_policy_2 is get_module.get_default_policy() + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_policy_propagation(get_module): + # The memory policy goes hand-in-hand with flags.owndata + +@@ -320,6 +328,7 @@ async def async_test_context_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_context_locality(get_module): + if (sys.implementation.name == 'pypy' + and sys.pypy_version_info[:3] < (7, 3, 6)): +@@ -341,6 +350,7 @@ def concurrent_thread2(get_module, event): + get_module.set_secret_data_policy() + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_thread_locality(get_module): + orig_policy_name = np.core.multiarray.get_handler_name() + +@@ -359,6 +369,7 @@ def test_thread_locality(get_module): + assert np.core.multiarray.get_handler_name() == orig_policy_name + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.skip(reason="too slow, see gh-23975") + def test_new_policy(get_module): + a = np.arange(10) +@@ -388,6 +399,8 @@ def test_new_policy(get_module): + c = np.arange(10) + assert np.core.multiarray.get_handler_name(c) == orig_policy_name + ++ ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + @pytest.mark.xfail(sys.implementation.name == "pypy", + reason=("bad interaction between getenv and " + "os.environ inside pytest")) +@@ -420,6 +433,8 @@ def test_switch_owner(get_module, policy): + else: + os.environ['NUMPY_WARN_IF_NO_MEM_POLICY'] = oldval + ++ ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") + def test_owner_is_base(get_module): + a = get_module.get_array_with_base() + with pytest.warns(UserWarning, match='warn_on_free'): + + +From 4552b6cb0083502f731794e961cd30b9b62ba2e3 Mon Sep 17 00:00:00 2001 +From: Ralf Gommers <ralf.gomm...@gmail.com> +Date: Mon, 19 Jun 2023 12:07:32 +0200 +Subject: [PATCH] TST: skip test using `np.load` on py2-saved .npy file on + py312 + +--- a/numpy/lib/tests/test_format.py ++++ b/numpy/lib/tests/test_format.py +@@ -527,6 +527,7 @@ def test_load_padded_dtype(tmpdir, dt): + assert_array_equal(arr, arr1) + + ++@pytest.mark.skipif(sys.version_info >= (3, 12), reason="see gh-23988") + @pytest.mark.xfail(IS_WASM, reason="Emscripten NODEFS has a buggy dup") + def test_python2_python3_interoperability(): + fname = 'win64python2.npy' diff --git a/dev-python/numpy/numpy-1.25.0.ebuild b/dev-python/numpy/numpy-1.25.0.ebuild index 9261cf73b3ba..fc0a38bcd8ac 100644 --- a/dev-python/numpy/numpy-1.25.0.ebuild +++ b/dev-python/numpy/numpy-1.25.0.ebuild @@ -5,7 +5,7 @@ EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=meson-python -PYTHON_COMPAT=( python3_{10..11} ) +PYTHON_COMPAT=( python3_{10..12} ) PYTHON_REQ_USE="threads(+)" FORTRAN_NEEDED=lapack @@ -52,6 +52,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/${PN}-1.25.0_rc1-meson-pyproject.toml.patch + "${FILESDIR}"/${PN}-1.25.0-skip-python3.12-irrelevant-tests.patch ) distutils_enable_tests pytest