summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorYaroslav Halchenko <debian@onerussian.com>2016-01-28 09:46:25 -0500
committerYaroslav Halchenko <debian@onerussian.com>2016-01-28 11:41:40 -0500
commitdc61b5eb3e2c1f0ee61a48a3fa9f7a290f5d1c84 (patch)
tree902e128d3eabd0af552c3da00028e9bde59f0a34 /numpy/lib/npyio.py
parent8a22dd42c2644c05500e2cea6974a6988a9dd01d (diff)
downloadnumpy-dc61b5eb3e2c1f0ee61a48a3fa9f7a290f5d1c84.tar.gz
BF: Since savez could be used with BytesIO - check if file is a string
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index a80053750..ebf43f3e4 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -630,8 +630,8 @@ def _savez(file, args, kwds, compress, allow_pickle=True, pickle_kwargs=None):
# Since target file might be big enough to exceed capacity of a global
# temporary directory, create temp file side-by-side with the target file.
- file_path, file_name = os.path.split(file)
- fd, tmpfile = tempfile.mkstemp(prefix=file_name, dir=file_path, suffix='-numpy.npy')
+ file_dir, file_prefix = os.path.split(file) if _is_string_like(file) else (None, 'tmp')
+ fd, tmpfile = tempfile.mkstemp(prefix=file_prefix, dir=file_dir, suffix='-numpy.npy')
os.close(fd)
try:
for key, val in namedict.items():