diff options
author | Jay Bourque <jay.bourque@continuum.io> | 2013-05-10 15:14:35 -0500 |
---|---|---|
committer | Jay Bourque <jay.bourque@continuum.io> | 2013-05-10 15:14:35 -0500 |
commit | 4d8e317919cf4a0fce7403848e2f12535e65b49d (patch) | |
tree | d2022574346764628ca051a9c2bd44fbfce48ded /numpy/lib/stride_tricks.py | |
parent | 6b892cf994889518a948987be8c57353d4250dad (diff) | |
download | numpy-4d8e317919cf4a0fce7403848e2f12535e65b49d.tar.gz |
Fix issue with broadcast_arrays() and user defined dtypes
broadcast_arrays() does not handle struct and custom dtypes correctly. Dtype of returned broadcasted arrays is always '|V8'. Fix broadcast_arrays() so that dtype of returned arrays is correct dtype for user defined dtypes.
Diffstat (limited to 'numpy/lib/stride_tricks.py')
-rw-r--r-- | numpy/lib/stride_tricks.py | 5 |
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): """ |