summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authornjsmith <njs@pobox.com>2012-07-06 14:01:54 -0700
committernjsmith <njs@pobox.com>2012-07-06 14:01:54 -0700
commit3b9a0fea12ae89fe6ce745d9af0beb3df17260b8 (patch)
treee5c78b184a72a1ceee5d5dba0351ccd1497b013e /numpy/lib/npyio.py
parentdd86cb378fb287e1e45ad8893097dc5a7f796aa8 (diff)
parent613589e2286b03171829bf4ff8cb5c9c863df4be (diff)
downloadnumpy-3b9a0fea12ae89fe6ce745d9af0beb3df17260b8.tar.gz
Merge pull request #328 from yarikoptic/master
fix ticket #2178: "own" (to close) file handles in load() only if they were not opened before
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 221529929..cb14e4963 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -359,7 +359,6 @@ def load(file, mmap_mode=None):
own_fid = True
elif isinstance(file, gzip.GzipFile):
fid = seek_gzip_factory(file)
- own_fid = True
else:
fid = file
@@ -371,7 +370,7 @@ def load(file, mmap_mode=None):
fid.seek(-N, 1) # back-up
if magic.startswith(_ZIP_PREFIX): # zip-file (assume .npz)
own_fid = False
- return NpzFile(fid, own_fid=True)
+ return NpzFile(fid, own_fid=own_fid)
elif magic == format.MAGIC_PREFIX: # .npy file
if mmap_mode:
return format.open_memmap(file, mode=mmap_mode)