diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-04-11 17:42:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-11 17:42:59 +0100 |
commit | f3682860cfe28cd73f46ae290add5d6fdbe43c89 (patch) | |
tree | 04cb8b5d806fec5ba25429cd26b5a53f6159c678 /numpy/lib/shape_base.py | |
parent | 8b6b1bc986b1ca8388975cab8d5264713f607ef0 (diff) | |
parent | fa56437c4eb4ca0c2a97597700a3fc6ad36963fa (diff) | |
download | numpy-f3682860cfe28cd73f46ae290add5d6fdbe43c89.tar.gz |
Merge pull request #8643 from eric-wieser/fix-8642
BUG: Fix double-wrapping of object scalars
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 857c8c09f..588047952 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -103,8 +103,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: |