From ff0c08796dcefc8a7cdebe7d2dc124469ce0eb42eb8d0215e2e715e44497ab4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 17 Jul 2020 19:11:56 +0000 Subject: [PATCH] Accepting request 821546 from home:alarrosa:branches:devel:languages:python:numeric - Add patch to fix the test_large_zip test in i586, which fails when run in a separate process (gh#numpy/numpy#16890): * 0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch OBS-URL: https://build.opensuse.org/request/show/821546 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=69 --- ...exception-in-test_large_zips-process.patch | 44 +++++++++++++++++++ python-numpy.changes | 7 +++ python-numpy.spec | 3 ++ 3 files changed, 54 insertions(+) create mode 100644 0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch diff --git a/0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch b/0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch new file mode 100644 index 0000000..f445353 --- /dev/null +++ b/0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch @@ -0,0 +1,44 @@ +diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py +index 664bfe6e5..6b94c2787 100644 +--- a/numpy/lib/tests/test_io.py ++++ b/numpy/lib/tests/test_io.py +@@ -13,7 +13,8 @@ from tempfile import NamedTemporaryFile + from io import BytesIO, StringIO + from datetime import datetime + import locale +-from multiprocessing import Process ++from multiprocessing import Process, Value ++from ctypes import c_bool + + import numpy as np + import numpy.ma as ma +@@ -574,16 +575,26 @@ class TestSaveTxt: + @pytest.mark.slow + @requires_memory(free_bytes=7e9) + def test_large_zip(self): +- def check_large_zip(): ++ def check_large_zip(memoryerror_raised): ++ memoryerror_raised.value=False + # The test takes at least 6GB of memory, writes a file larger than 4GB + test_data = np.asarray([np.random.rand(np.random.randint(50,100),4) + for i in range(800000)], dtype=object) + with tempdir() as tmpdir: +- np.savez(os.path.join(tmpdir, 'test.npz'), test_data=test_data) ++ try: ++ np.savez(os.path.join(tmpdir, 'test.npz'), test_data=test_data) ++ except MemoryError: ++ memoryerror_raised.value=True ++ raise + # run in a subprocess to ensure memory is released on PyPy, see gh-15775 +- p = Process(target=check_large_zip) ++ # Use an object in shared memory to re-raise the MemoryError exception ++ # in our process if needed, see gh-16889 ++ memoryerror_raised = Value(c_bool) ++ p = Process(target=check_large_zip, args=(memoryerror_raised,)) + p.start() + p.join() ++ if memoryerror_raised.value: ++ raise MemoryError("Child process raised a MemoryError exception") + assert p.exitcode == 0 + + class LoadTxtBase: diff --git a/python-numpy.changes b/python-numpy.changes index e9469bc..e0c5dea 100644 --- a/python-numpy.changes +++ b/python-numpy.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jul 17 11:08:29 UTC 2020 - Antonio Larrosa + +- Add patch to fix the test_large_zip test in i586, which fails + when run in a separate process (gh#numpy/numpy#16890): + * 0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch + ------------------------------------------------------------------- Thu Jul 2 16:55:48 UTC 2020 - Antonio Larrosa diff --git a/python-numpy.spec b/python-numpy.spec index a42a424..b236b14 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -84,6 +84,8 @@ Patch1: numpy-1.9.0-remove-__declspec.patch # # PATCH-FIX-SLE fix-py34-tests.patch -- python 3.4 support Patch3: fix-py34-tests.patch Patch4: s390x.patch +# PATCH-FIX-UPSTREAM fix-test_large_zip-in-i586.patch -- gh#numpy/numpy#16890 +Patch5: 0001-Re-raise-MemoryError-exception-in-test_large_zips-process.patch BuildRequires: %{python_module Cython >= 0.29.17} BuildRequires: %{python_module devel} BuildRequires: %{python_module hypothesis >= 5.12.0} @@ -163,6 +165,7 @@ This package contains files for developing applications using numpy. # TestF{77,90}ReturnCharacter are broken on all big-endian architectures (#11831) %patch4 -p1 %endif +%patch5 -p1 # Fix non-executable scripts sed -i '1s/^#!.*$//' numpy/{compat/setup,random/_examples/cython/setup,distutils/{conv_template,cpuinfo,exec_command,from_template,setup,system_info},f2py/{__init__,auxfuncs,capi_maps,cb_rules,cfuncs,common_rules,crackfortran,diagnose,f2py2e,f90mod_rules,func2subr,rules,setup,use_rules},ma/{setup,bench},matrixlib/setup,setup,testing/{print_coercion_tables,setup}}.py sed -i '1s/^#!.*$//' numpy/random/_examples/cython/*.pyx