Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 018a202

Browse filesBrowse files
committed
ENH: improve error messages inlib._format_impl.read_array
1 parent 95753c6 commit 018a202
Copy full SHA for 018a202

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎numpy/lib/_format_impl.py

Copy file name to clipboardExpand all lines: numpy/lib/_format_impl.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ def read_array(fp, allow_pickle=False, pickle_kwargs=None, *,
874874
count=read_count)
875875

876876
if array.size != count:
877-
raise IOError("Failed to read all data for array")
877+
raise ValueError(f"Failed to read all data for array. Expected {shape} = {count} elements, read {array.size} elements.")
878878

879879
if fortran_order:
880880
array.shape = shape[::-1]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.