summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-06-11 12:45:49 -0600
committerGitHub <noreply@github.com>2018-06-11 12:45:49 -0600
commit2f381fedddfec79f1c059c1b1ecc466593ecd691 (patch)
tree9693e53e2332ac68b281131fa39040ccce0afeca /numpy
parent1b920805704095fde1b8f6ad7ff81a62f5176dd6 (diff)
parentb4e10f096f8c2c345de74a8713afd8cadc7930a9 (diff)
downloadnumpy-2f381fedddfec79f1c059c1b1ecc466593ecd691.tar.gz
Merge pull request #11307 from pgunn/master_fix_earlier_diff
BUG: Fix memmap regression when shape=None
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,))