summaryrefslogtreecommitdiff
path: root/numpy/lib/shape_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-04-25 15:22:58 -0600
committerGitHub <noreply@github.com>2020-04-25 15:22:58 -0600
commit651bb25d6b409b9031c40cf33f991d24f350edd3 (patch)
treec964055c79859d1cb901c42b42e1ae946af4699e /numpy/lib/shape_base.py
parentf80584a48ca9bcb2ff451a017bee2479ad78aa28 (diff)
parentcadea53d822cf8e5c31ada659e49212bdceb3204 (diff)
downloadnumpy-651bb25d6b409b9031c40cf33f991d24f350edd3.tar.gz
Merge pull request #16064 from keremh/fix-exception-raise
ENH: Fix exception causes in four .py files
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r--numpy/lib/shape_base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index b7f1f16f2..72a7f79d7 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -372,8 +372,10 @@ def apply_along_axis(func1d, axis, arr, *args, **kwargs):
# invoke the function on the first item
try:
ind0 = next(inds)
- except StopIteration:
- raise ValueError('Cannot apply_along_axis when any iteration dimensions are 0')
+ except StopIteration as e:
+ raise ValueError(
+ 'Cannot apply_along_axis when any iteration dimensions are 0'
+ ) from None
res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
# build a buffer for storing evaluations of func1d.