Skip to content

Commit da368f1

Browse files
committed
DOC: Note that allow-pickle is not safe also in error
This is the one thing that makes sense to me: nobody reads the documentation, so it may make sense to point out unsafe here. (Although, the message already said turn off `allow_pickle=False` in a sense. So it wasn't like the can quite copy paste the suggestion.)
1 parent 6a85517 commit da368f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

numpy/lib/_npyio_impl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,10 @@ def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True,
483483
else:
484484
# Try a pickle
485485
if not allow_pickle:
486-
raise ValueError("Cannot load file containing pickled data "
487-
"when allow_pickle=False")
486+
raise ValueError(
487+
"This file contains pickled (object) data. If you trust "
488+
"the file you can load it unsafely using the "
489+
"`allow_pickle=` keyword argument or `pickle.load()`.")
488490
try:
489491
return pickle.load(fid, **pickle_kwargs)
490492
except Exception as e:

0 commit comments

Comments
 (0)