summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-01-02 23:48:39 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-02-11 21:09:07 +0000
commitb10b6c290ded55e410543b9d09686042be3db6ec (patch)
tree4a2d642fbf5d050c193c9ae192d12823058dc184 /numpy/lib/shape_base.py
parent5307aeda11a5d567a966a16232860fd852734606 (diff)
downloadnumpy-b10b6c290ded55e410543b9d09686042be3db6ec.tar.gz
BUG: Call __array_prepare__ before __array_wrap__
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index dfee35f96..7e70904b1 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -116,7 +116,7 @@ def apply_along_axis(func1d, axis, arr, *args, **kwargs):
# insert as many axes as necessary to create the output
outshape = arr.shape[:axis] + res.shape + arr.shape[axis+1:]
outarr = zeros(outshape, res.dtype)
- outarr = res.__array_wrap__(outarr)
+ outarr = res.__array_prepare__(outarr)
# outarr, with inserted dimensions at the end
# this means that outarr_view[i] = func1d(inarr_view[i])
@@ -127,6 +127,9 @@ def apply_along_axis(func1d, axis, arr, *args, **kwargs):
outarr_view[ind0] = res
for ind in inds:
outarr_view[ind] = asanyarray(func1d(inarr_view[ind], *args, **kwargs))
+
+ outarr = res.__array_wrap__(outarr)
+
return outarr