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.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py
index a5f247abf..e7649cb60 100644
--- a/numpy/lib/stride_tricks.py
+++ b/numpy/lib/stride_tricks.py
@@ -46,9 +46,11 @@ def as_strided(x, shape=None, strides=None, subok=False):
if strides is not None:
interface['strides'] = tuple(strides)
array = np.asarray(DummyArray(interface, base=x))
- # Make sure dtype is correct in case of custom dtype
- if array.dtype.kind == 'V':
+
+ if array.dtype.fields is None and x.dtype.fields is not None:
+ # This should only happen if x.dtype is [('', 'Vx')]
array.dtype = x.dtype
+
return _maybe_view_as_subclass(x, array)