@@ -2420,7 +2420,7 @@ def _recursive_printoption(result, mask, printopt):
2420
2420
names = result .dtype .names
2421
2421
for name in names :
2422
2422
(curdata , curmask ) = (result [name ], mask [name ])
2423
- if curdata .dtype .names :
2423
+ if result .dtype [ name ] .names :
2424
2424
_recursive_printoption (curdata , curmask , printopt )
2425
2425
else :
2426
2426
np .copyto (curdata , printopt , where = curmask )
@@ -6004,7 +6004,7 @@ def __new__(self, data, mask=nomask, dtype=None, fill_value=None,
6004
6004
6005
6005
def _get_data (self ):
6006
6006
# Make sure that the _data part is a np.void
6007
- return self . view ( ndarray ) [()]
6007
+ return super ( mvoid , self ). _data [()]
6008
6008
6009
6009
_data = property (fget = _get_data )
6010
6010
@@ -6040,19 +6040,13 @@ def __setitem__(self, indx, value):
6040
6040
def __str__ (self ):
6041
6041
m = self ._mask
6042
6042
if m is nomask :
6043
- return self ._data .__str__ ()
6044
- printopt = masked_print_option
6045
- rdtype = _replace_dtype_fields (self ._data .dtype , "O" )
6046
-
6047
- # temporary hack to fix gh-7493. A more permanent fix
6048
- # is proposed in gh-6053, after which the next two
6049
- # lines should be changed to
6050
- # res = np.array([self._data], dtype=rdtype)
6051
- res = np .empty (1 , rdtype )
6052
- res [:1 ] = self ._data
6043
+ return str (self ._data )
6053
6044
6054
- _recursive_printoption (res , self ._mask , printopt )
6055
- return str (res [0 ])
6045
+ rdtype = _replace_dtype_fields (self ._data .dtype , "O" )
6046
+ data_arr = super (mvoid , self )._data
6047
+ res = data_arr .astype (rdtype )
6048
+ _recursive_printoption (res , self ._mask , masked_print_option )
6049
+ return str (res )
6056
6050
6057
6051
__repr__ = __str__
6058
6052
0 commit comments