diff options
author | Denis Laxalde <denis@laxalde.org> | 2012-05-08 15:20:29 -0400 |
---|---|---|
committer | Denis Laxalde <denis@laxalde.org> | 2012-05-08 15:34:38 -0400 |
commit | 37fab7a8fcf72653289a3a3453130696977eb0f7 (patch) | |
tree | 1b021e1f29f1a291199ee9b79860697f33ed0ff1 /numpy/core/numeric.py | |
parent | 5bc0a84022c2c65addf306f50eef6f37244ae595 (diff) | |
download | numpy-37fab7a8fcf72653289a3a3453130696977eb0f7.tar.gz |
FIX: roll raises a ValueError is axis > ndim
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))) |