diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/format.py | 2 | ||||
-rw-r--r-- | numpy/lib/stride_tricks.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_format.py | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/numpy/lib/format.py b/numpy/lib/format.py index a0f2c5497..cfe0e62ac 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -623,7 +623,7 @@ def read_array(fp, allow_pickle=True, pickle_kwargs=None): if len(shape) == 0: count = 1 else: - count = numpy.multiply.reduce(shape) + count = numpy.multiply.reduce(shape, dtype=numpy.int64) # Now read the actual data. if dtype.hasobject: diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py index a87c34fb5..f390cf49b 100644 --- a/numpy/lib/stride_tricks.py +++ b/numpy/lib/stride_tricks.py @@ -244,7 +244,7 @@ def broadcast_arrays(*args, **kwargs): subok = kwargs.pop('subok', False) if kwargs: raise TypeError('broadcast_arrays() got an unexpected keyword ' - 'argument {}'.format(kwargs.pop())) + 'argument {!r}'.format(kwargs.keys()[0])) args = [np.array(_m, copy=False, subok=subok) for _m in args] shape = _broadcast_shape(*args) diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index a091ef5b3..46b21707f 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -836,5 +836,19 @@ def test_large_file_support(): assert_array_equal(r, d) +@dec.slow +def test_large_archive(): + a = np.empty((2 ** 30, 2), dtype=np.uint8) + fname = os.path.join(tempdir, "large_archive") + + with open(fname, "wb") as f: + np.savez(f, arr=a) + + with open(fname, "rb") as f: + new_a = np.load(f)["arr"] + + assert a.shape == new_a.shape + + if __name__ == "__main__": run_module_suite() |