summaryrefslogtreecommitdiff
path: root/numpy/core/ma.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-17 00:07:21 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-17 00:07:21 +0000
commit4593515985f1aa30cf07715ace5eeee6da848c97 (patch)
treeab13435f4bec383abc7c04ca7b0259b44dd2519d /numpy/core/ma.py
parenta397b5545b1a20e1b0e39881eb8cf8d2dd26b793 (diff)
downloadnumpy-4593515985f1aa30cf07715ace5eeee6da848c97.tar.gz
Fixed up usage of dtype to be consistent with new dtype objects.
Diffstat (limited to 'numpy/core/ma.py')
-rw-r--r--numpy/core/ma.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py
index c736b3e34..27831fdde 100644
--- a/numpy/core/ma.py
+++ b/numpy/core/ma.py
@@ -545,14 +545,16 @@ class MaskedArray (object):
"""array(data, dtype=None, copy=True, fortran=False, mask=nomask, fill_value=None)
If data already a numeric array, its dtype becomes the default value of dtype.
"""
- tc = dtype
+ if dtype is None:
+ tc = None
+ else:
+ tc = numeric.dtype(dtype)
need_data_copied = copy
if isinstance(data, MaskedArray):
c = data.data
- ctc = c.dtype.char
if tc is None:
- tc = ctc
- elif dtype2char(tc) != ctc:
+ tc = c.dtype
+ elif tc != c.dtype:
need_data_copied = True
if mask is nomask:
mask = data.mask
@@ -561,17 +563,17 @@ class MaskedArray (object):
elif isinstance(data, ndarray):
c = data
- ctc = c.dtype.char
if tc is None:
- tc = ctc
- elif dtype2char(tc) != ctc:
+ tc = c.dtype
+ elif tc != c.dtype:
need_data_copied = True
else:
need_data_copied = False #because I'll do it now
c = numeric.array(data, dtype=tc, copy=True, fortran=fortran)
+ tc = c.dtype
if need_data_copied:
- if tc == ctc:
+ if tc == c.dtype:
self._data = numeric.array(c, dtype=tc, copy=True, fortran=fortran)
else:
self._data = c.astype(tc)