From 92b9e8446d342a35fbea2dd004a99f2815b14f69 Mon Sep 17 00:00:00 2001 From: Luke Carmichael Date: Fri, 8 Nov 2013 16:18:49 -0500 Subject: When reading file in chunks, buffer_size < dtype.itemsize, ensure at least one read --- numpy/lib/format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/format.py') diff --git a/numpy/lib/format.py b/numpy/lib/format.py index fd5496e96..c411715d8 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -464,7 +464,7 @@ def read_array(fp): # non-chunked case count < max_read_count, so only one read is # performed. - max_read_count = BUFFER_SIZE // dtype.itemsize + max_read_count = BUFFER_SIZE // min(BUFFER_SIZE, dtype.itemsize) array = numpy.empty(count, dtype=dtype) -- cgit v1.2.1