summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r--numpy/core/memmap.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index 536fa6094..190de2a77 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -211,6 +211,9 @@ class memmap(ndarray):
raise ValueError("mode must be one of %s" %
(valid_filemodes + list(mode_equivalents.keys())))
+ if mode == 'w+' and shape is None:
+ raise ValueError("shape must be given")
+
if hasattr(filename, 'read'):
fid = filename
own_file = False
@@ -221,9 +224,6 @@ class memmap(ndarray):
fid = open(filename, (mode == 'c' and 'r' or mode)+'b')
own_file = True
- if (mode == 'w+') and shape is None:
- raise ValueError("shape must be given")
-
fid.seek(0, 2)
flen = fid.tell()
descr = dtypedescr(dtype)