diff options
author | Max Sperlich <max.sperlich@livingsocial.com> | 2013-12-08 20:57:23 -0500 |
---|---|---|
committer | Max Sperlich <max.sperlich@livingsocial.com> | 2013-12-08 20:57:23 -0500 |
commit | aa2443af6e6de74edff19757ba1c827b69f7640f (patch) | |
tree | 164edf04c50c9990594ed653a68832506403032d /numpy/lib/format.py | |
parent | faf4131f6b264477e4047257440eebdf27c2f767 (diff) | |
download | numpy-aa2443af6e6de74edff19757ba1c827b69f7640f.tar.gz |
TST: Adds test case for Issue 4093
Diffstat (limited to 'numpy/lib/format.py')
-rw-r--r-- | numpy/lib/format.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/format.py b/numpy/lib/format.py index 8eb5059a0..2dd1a68af 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -481,6 +481,10 @@ def read_array(fp): while i < count: read_count = min(max_read_count, count - i) data = extra_data + fp.read(int(read_count * dtype.itemsize)) + if len(data) == len(extra_data): + #Unable to read sufficient data from fp + msg = "EOF: expected %d entries, got %d entries" % (count, i) + raise ValueError(msg) actual_count = len(data) // dtype.itemsize extra_data = data[actual_count*dtype.itemsize:] array[i:i+actual_count] = numpy.frombuffer(data, dtype=dtype, |