Merge pull request #17672 from bernt-matthias/topic/npz-sniff

[23.2] Npz sniffing: do not read the whole file
This commit is contained in:
Marius van den Beek
2024-03-12 14:52:21 +01:00
committed by GitHub
+1 -3
View File
@@ -4331,9 +4331,7 @@ class Npz(CompressedArchive):
try:
npz = np.load(filename)
if isinstance(npz, np.lib.npyio.NpzFile):
for f in npz.files:
if isinstance(npz[f], np.ndarray):
return True
return True
except Exception:
return False
return False