summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/memmap.py1
-rw-r--r--numpy/core/tests/test_memmap.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index b2ff0e793..536fa6094 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -236,6 +236,7 @@ class memmap(ndarray):
raise ValueError("Size of available data is not a "
"multiple of the data-type size.")
size = bytes // _dbytes
+ shape = (size,)
else:
if not isinstance(shape, tuple):
shape = (shape,)
diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py
index 6c88a9c2c..59ca28324 100644
--- a/numpy/core/tests/test_memmap.py
+++ b/numpy/core/tests/test_memmap.py
@@ -196,3 +196,8 @@ class TestMemmap(object):
offset = mmap.ALLOCATIONGRANULARITY + 1
fp = memmap(self.tmpfp, shape=size, mode='w+', offset=offset)
assert_(fp.offset == offset)
+
+ def test_no_shape(self):
+ self.tmpfp.write(b'a'*16)
+ mm = memmap(self.tmpfp, dtype='float64')
+ assert_equal(mm.shape, (2,))