diff options
-rw-r--r-- | numpy/ma/core.py | 5 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 65e44673c..105dd30ec 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -4582,12 +4582,13 @@ class MaskedArray(ndarray): purposes. """ + cf = 'CF'[self.flags.fnc] state = (1, self.shape, self.dtype, self.flags.fnc, - self._data.tostring(), - getmaskarray(self).tostring(), + self._data.tostring(cf), + getmaskarray(self).tostring(cf), self._fill_value, ) return state diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index e994a67c6..549f864b7 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -388,6 +388,14 @@ class TestMaskedArray(TestCase): assert_equal(a_pickled._mask, a._mask) assert_equal(a_pickled, a) + def test_pickling_keepalignment(self): + "Tests pickling w/ F_CONTIGUOUS arrays" + import cPickle + a = arange(10) + a.shape = (-1, 2) + b = a.T + test = cPickle.loads(cPickle.dumps(b)) + assert_equal(test, b) def test_single_element_subscript(self): "Tests single element subscripts of Maskedarrays." |