diff options
| author | mattip <matti.picus@gmail.com> | 2023-02-15 12:35:30 +0200 |
|---|---|---|
| committer | mattip <matti.picus@gmail.com> | 2023-02-15 12:35:30 +0200 |
| commit | 6ef6233d5493dc2e18232304e1c3b8b0ae6f27c8 (patch) | |
| tree | 1d6a34eea21e96cd149fa5b40a04c6fb59d2307b /numpy | |
| parent | 2a6e24192141264dfcc8f4d0f3f7a921b58a5056 (diff) | |
| download | numpy-6ef6233d5493dc2e18232304e1c3b8b0ae6f27c8.tar.gz | |
TEST: remove very slow test, add it as a comment to the code snippet it tests
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/src/multiarray/convert.c | 19 | ||||
| -rw-r--r-- | numpy/core/tests/test_multiarray.py | 27 |
2 files changed, 18 insertions, 28 deletions
diff --git a/numpy/core/src/multiarray/convert.c b/numpy/core/src/multiarray/convert.c index ef231587d..e99bc3fe4 100644 --- a/numpy/core/src/multiarray/convert.c +++ b/numpy/core/src/multiarray/convert.c @@ -157,7 +157,24 @@ PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) NPY_BEGIN_ALLOW_THREADS; #if defined (_MSC_VER) && defined(_WIN64) - /* Workaround Win64 fwrite() bug. Ticket #1660 */ + /* Workaround Win64 fwrite() bug. Issue gh-2556 + * If you touch this code, please run this test which is so slow + * it was removed from the test suite + * + * fourgbplus = 2**32 + 2**16 + * testbytes = np.arange(8, dtype=np.int8) + * n = len(testbytes) + * flike = tempfile.NamedTemporaryFile() + * f = flike.file + * np.tile(testbytes, fourgbplus // testbytes.nbytes).tofile(f) + * flike.seek(0) + * a = np.fromfile(f, dtype=np.int8) + * flike.close() + * assert_(len(a) == fourgbplus) + * # check only start and end for speed: + * assert_((a[:n] == testbytes).all()) + * assert_((a[-n:] == testbytes).all()) + */ { npy_intp maxsize = 2147483648 / PyArray_DESCR(self)->elsize; npy_intp chunksize; diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 2d6f9c38c..422edf9a7 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -5552,33 +5552,6 @@ class TestIO: tmp_filename, dtype='<f4') - @pytest.mark.slow # takes > 1 minute on mechanical hard drive - def test_big_binary(self): - """Test workarounds for 32-bit limit for MSVC fwrite, fseek, and ftell - - These normally would hang doing something like this. - See : https://github.com/numpy/numpy/issues/2256 - """ - if sys.platform != 'win32' or '[GCC ' in sys.version: - return - try: - # before workarounds, only up to 2**32-1 worked - fourgbplus = 2**32 + 2**16 - testbytes = np.arange(8, dtype=np.int8) - n = len(testbytes) - flike = tempfile.NamedTemporaryFile() - f = flike.file - np.tile(testbytes, fourgbplus // testbytes.nbytes).tofile(f) - flike.seek(0) - a = np.fromfile(f, dtype=np.int8) - flike.close() - assert_(len(a) == fourgbplus) - # check only start and end for speed: - assert_((a[:n] == testbytes).all()) - assert_((a[-n:] == testbytes).all()) - except (MemoryError, ValueError): - pass - def test_string(self, tmp_filename): self._check_from(b'1,2,3,4', [1., 2., 3., 4.], tmp_filename, sep=',') |
