diff options
| author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-19 14:07:03 +0000 |
|---|---|---|
| committer | Eric Wieser <wieser.eric@gmail.com> | 2017-04-06 19:06:37 +0100 |
| commit | fa56437c4eb4ca0c2a97597700a3fc6ad36963fa (patch) | |
| tree | 25bf8e635e1e22a7add72249ed4b29e7aacabcb2 /numpy/lib/shape_base.py | |
| parent | aba10bb5829caee63a20251a226d8cb716ec1125 (diff) | |
| download | numpy-fa56437c4eb4ca0c2a97597700a3fc6ad36963fa.tar.gz | |
BUG: Fix double-wrapping of object scalars
Fixes #8642
Diffstat (limited to 'numpy/lib/shape_base.py')
| -rw-r--r-- | numpy/lib/shape_base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 58e13533b..81d8d9d17 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -105,8 +105,10 @@ def apply_along_axis(func1d, axis, arr, *args, **kwargs): in_dims = list(range(nd)) inarr_view = transpose(arr, in_dims[:axis] + in_dims[axis+1:] + [axis]) - # compute indices for the iteration axes + # compute indices for the iteration axes, and append a trailing ellipsis to + # prevent 0d arrays decaying to scalars, which fixes gh-8642 inds = ndindex(inarr_view.shape[:-1]) + inds = (ind + (Ellipsis,) for ind in inds) # invoke the function on the first item try: |
