diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-03-12 18:42:59 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-03-12 18:42:59 -0400 |
commit | e84454aded855a70c3dcfd586a3a0c0e108d0ab7 (patch) | |
tree | d33488675ac1dd3f2092ba5de05e11d857cc12e0 /numpy/lib/stride_tricks.py | |
parent | 27c68a30de03fbf65bc949e014851644f436fda8 (diff) | |
parent | 0808ae8fc5e3d539989aeceb74cbac35bb55598e (diff) | |
download | numpy-e84454aded855a70c3dcfd586a3a0c0e108d0ab7.tar.gz |
Merge pull request #5519 from jaimefrio/array_interface_dtype
ENH: PyArray_FromInterface checks descr if typestr is np.void
Diffstat (limited to 'numpy/lib/stride_tricks.py')
-rw-r--r-- | numpy/lib/stride_tricks.py | 6 |
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) |