summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/ma/core.py6
-rw-r--r--numpy/ma/tests/test_core.py10
2 files changed, 16 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index fb28fa8e5..c0dda6f31 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -6317,6 +6317,12 @@ class MaskedConstant(MaskedArray):
# precedent for this with `np.bool_` scalars.
return self
+ def __copy__(self):
+ return self
+
+ def __deepcopy__(self, memo):
+ return self
+
def __setattr__(self, attr, value):
if not self.__has_singleton():
# allow the singleton to be initialized
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 63703f6cd..4c7440aab 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -4826,6 +4826,16 @@ class TestMaskedConstant(object):
np.ma.masked.copy() is np.ma.masked,
np.True_.copy() is np.True_)
+ def test__copy(self):
+ import copy
+ assert_(
+ copy.copy(np.ma.masked) is np.ma.masked)
+
+ def test_deepcopy(self):
+ import copy
+ assert_(
+ copy.deepcopy(np.ma.masked) is np.ma.masked)
+
def test_immutable(self):
orig = np.ma.masked
assert_raises(np.ma.core.MaskError, operator.setitem, orig, (), 1)