diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-09 18:51:08 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-02-20 22:03:10 +0000 |
commit | 8d6ec65c925ebef5e0567708de1d16df39077c9d (patch) | |
tree | 89eb436cf6d453f807becfceef773f053b0ba146 /numpy/core/numeric.py | |
parent | eb642f1b6533fcd92e366377f5859e4ea56d5eed (diff) | |
download | numpy-8d6ec65c925ebef5e0567708de1d16df39077c9d.tar.gz |
MAINT: Be specific about where AxisError is raised
These were tested by temporarily removing the base classes from AxisError
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index e7307a870..066697f3e 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1532,7 +1532,7 @@ def rollaxis(a, axis, start=0): start += n msg = "'%s' arg requires %d <= %s < %d, but %d was passed in" if not (0 <= start < n + 1): - raise IndexError(msg % ('start', -n, 'start', n + 1, start)) + raise AxisError(msg % ('start', -n, 'start', n + 1, start)) if axis < start: # it's been removed start -= 1 @@ -1551,7 +1551,7 @@ def _validate_axis(axis, ndim, argname): axis = list(axis) axis = [a + ndim if a < 0 else a for a in axis] if not builtins.all(0 <= a < ndim for a in axis): - raise IndexError('invalid axis for this array in `%s` argument' % + raise AxisError('invalid axis for this array in `%s` argument' % argname) if len(set(axis)) != len(axis): raise ValueError('repeated axis in `%s` argument' % argname) |