From 2303556949b96c4220ed86fa4554f6a87dec3842 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 13 Jan 2023 21:24:35 +0100 Subject: ENH: Faster numpy.load (try/except _filter_header) (#22916) This pull requests speeds up numpy.load. Since _filter_header is quite a bottleneck, we only run it if we must. Users will get a warning if they have a legacy Numpy file so that they can save it again for faster loading. Main discussion and benchmarks see #22898 Co-authored-by: Sebastian Berg --- numpy/lib/tests/test_format.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/lib/tests') diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 6f6406cf8..58d08f1e5 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -531,7 +531,8 @@ def test_load_padded_dtype(tmpdir, dt): def test_python2_python3_interoperability(): fname = 'win64python2.npy' path = os.path.join(os.path.dirname(__file__), 'data', fname) - data = np.load(path) + with pytest.warns(UserWarning, match="Reading.*this warning\\."): + data = np.load(path) assert_array_equal(data, np.ones(2)) def test_pickle_python2_python3(): -- cgit v1.2.1