diff options
-rw-r--r-- | numpy/ma/core.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_regression.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index a7e04cd13..bcd24d22b 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -414,7 +414,7 @@ def _check_fill_value(fill_value, ndtype): fill_value = np.array(_recursive_set_fill_value(fill_value, descr), dtype=ndtype) else: - if isinstance(fill_value, basestring) and (ndtype.char not in 'SV'): + if isinstance(fill_value, basestring) and (ndtype.char not in 'SVU'): fill_value = default_fill_value(ndtype) else: # In case we want to convert 1e+20 to int... diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index 62e4ee0ae..e3a5d9613 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -44,6 +44,11 @@ class TestRegression(TestCase): assert_(a.mask.ndim == 1) assert_(b.mask.ndim == 2) + def test_set_fill_value_unicode_py3(self): + """Ticket #2733""" + a = np.ma.masked_array(['a', 'b', 'c'], mask=[1, 0, 0]) + a.fill_value = 'X' + assert_(a.fill_value == 'X') if __name__ == "__main__": run_module_suite() |