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
This commit is contained in:
parent
9e0ee404c8
commit
ff0c08796d
@ -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:
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 17 11:08:29 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>
|
||||
|
||||
- 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 <alarrosa@suse.com>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user