diff options
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r-- | numpy/core/memmap.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index b0d9cb3af..21341b2e3 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -59,6 +59,7 @@ class memmap(ndarray): | 'r+' | Open existing file for reading and writing. | +------+-------------------------------------------------------------+ | 'w+' | Create or overwrite existing file for reading and writing. | + | | If ``mode == 'w+'`` then `shape` must also be specified. | +------+-------------------------------------------------------------+ | 'c' | Copy-on-write: assignments affect data in memory, but | | | changes are not saved to disk. The file on disk is | @@ -220,7 +221,7 @@ class memmap(ndarray): ) from None if mode == 'w+' and shape is None: - raise ValueError("shape must be given") + raise ValueError("shape must be given if mode == 'w+'") if hasattr(filename, 'read'): f_ctx = nullcontext(filename) |