summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-12-11 10:12:11 -0700
committerGitHub <noreply@github.com>2017-12-11 10:12:11 -0700
commit8a847c8b075f8ba39bdf81ff216b022d99f6fc6b (patch)
tree736cc66448b1e39efc158dc1e98f433f9a708536 /numpy/ma/core.py
parent06b972f05072a9390808bf2c895427ce8a46bb42 (diff)
parent7df73defce92506b4b67b37ed1c9164347f0f986 (diff)
downloadnumpy-8a847c8b075f8ba39bdf81ff216b022d99f6fc6b.tar.gz
Merge pull request #10192 from eric-wieser/deprecate-pickle-aliases
DEP: Deprecate the pickle aliases
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 9f439a634..dad675600 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -7859,6 +7859,16 @@ def asanyarray(a, dtype=None):
##############################################################################
# Pickling #
##############################################################################
+
+def _pickle_warn(method):
+ # NumPy 1.15.0, 2017-12-10
+ warnings.warn(
+ "np.ma.{method} is deprecated, use pickle.{method} instead"
+ .format(method),
+ DeprecationWarning,
+ stacklevel=3)
+
+
def dump(a, F):
"""
Pickle a masked array to a file.
@@ -7873,6 +7883,7 @@ def dump(a, F):
The file to pickle `a` to. If a string, the full path to the file.
"""
+ _pickle_warn('dump')
if not hasattr(F, 'readline'):
with open(F, 'w') as F:
pickle.dump(a, F)
@@ -7893,6 +7904,7 @@ def dumps(a):
returned.
"""
+ _pickle_warn('dumps')
return pickle.dumps(a)
@@ -7916,6 +7928,7 @@ def load(F):
the NumPy binary .npy format.
"""
+ _pickle_warn('load')
if not hasattr(F, 'readline'):
with open(F, 'r') as F:
return pickle.load(F)
@@ -7939,6 +7952,7 @@ def loads(strg):
dumps : Return a string corresponding to the pickling of a masked array.
"""
+ _pickle_warn('loads')
return pickle.loads(strg)