summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/ma/core.py3
-rw-r--r--numpy/ma/tests/test_core.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 4c574b3be..fc086e5b7 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -5643,6 +5643,9 @@ class mvoid(MaskedArray):
else:
yield d
+ def __len__(self):
+ return self._data.__len__()
+
def filled(self, fill_value=None):
"""
Return a copy with masked fields filled with a given value.
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 523eb77fc..3b25090ab 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -3527,6 +3527,10 @@ class TestMaskedFields(TestCase):
a[0]['a'] = 2
assert_equal(a.mask, control)
+ def test_element_len(self):
+ # check that len() works for mvoid (Github issue #576)
+ for rec in self.data['base']:
+ assert_equal(len(rec), len(self.data['ddtype']))
#------------------------------------------------------------------------------