summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-09-26 23:45:15 -0700
committerEric Wieser <wieser.eric@gmail.com>2017-11-12 11:38:35 -0800
commitdf0fff45adbd3f291632b23c0cbd256bbbe912bb (patch)
tree120f4082267ac217783f8453cb97dd6f335a62dc /numpy/ma/core.py
parenta4e47e0205b78eb96248e71918c2558e25a9d3c7 (diff)
downloadnumpy-df0fff45adbd3f291632b23c0cbd256bbbe912bb.tar.gz
BUG: str(arr0d) and unicode(arr0d) should never go through np.set_string_function
It's more important that scalars and 0d arrays are consistent here. Previously, unicode(arr0d) would crash on 2.7
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index b71e8fa06..0d02bb315 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3867,6 +3867,10 @@ class MaskedArray(ndarray):
def __str__(self):
return str(self._insert_masked_print())
+ if sys.version_info.major < 3:
+ def __unicode__(self):
+ return unicode(self._insert_masked_print())
+
def __repr__(self):
"""
Literal string representation.
@@ -6238,6 +6242,10 @@ class MaskedConstant(MaskedArray):
def __str__(self):
return str(masked_print_option._display)
+ if sys.version_info.major < 3:
+ def __unicode__(self):
+ return unicode(masked_print_option._display)
+
def __repr__(self):
if self is MaskedConstant.__singleton:
return 'masked'