diff options
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 9a51229a1..8212dd6ce 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1179,7 +1179,10 @@ def roll(a, shift, axis=None): n = a.size reshape = True else: - n = a.shape[axis] + try: + n = a.shape[axis] + except IndexError: + raise ValueError('axis must be >= 0 and < %d' % a.ndim) reshape = False shift %= n indexes = concatenate((arange(n-shift,n),arange(n-shift))) |