Skip to content

Commit 62c7ee8

Browse files
authored
Merge pull request numpy#27763 from seberg/pickle-error
DOC: Note that allow-pickle is not safe also in error
2 parents 9150cac + da368f1 commit 62c7ee8

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)