summaryrefslogtreecommitdiff
path: root/numpy/core/defmatrix.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r--numpy/core/defmatrix.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index 9eb8e0011..b0d45972e 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -63,7 +63,10 @@ class matrix(N.ndarray):
return data.astype(dtype)
if isinstance(data, N.ndarray):
- intype = N.dtypedescr(dtype)
+ if dtype is None:
+ intype = data.dtypedescr
+ else:
+ intype = N.dtypedescr(dtype)
new = data.view(matrix)
if intype != data.dtypedescr:
return new.astype(intype)