summaryrefslogtreecommitdiff
path: root/numpy/lib/stride_tricks.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/stride_tricks.py')
-rw-r--r--numpy/lib/stride_tricks.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py
index 1f08131ec..7b6b06fdc 100644
--- a/numpy/lib/stride_tricks.py
+++ b/numpy/lib/stride_tricks.py
@@ -27,7 +27,10 @@ def as_strided(x, shape=None, strides=None):
interface['shape'] = tuple(shape)
if strides is not None:
interface['strides'] = tuple(strides)
- return np.asarray(DummyArray(interface, base=x))
+ array = np.asarray(DummyArray(interface, base=x))
+ # Make sure dtype is correct in case of custom dtype
+ array.dtype = x.dtype
+ return array
def broadcast_arrays(*args):
"""