-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: MaskedArray.count treats negative axes incorrectly #7515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Follow up to numpy#5706. Fixes numpy#7509
if len(axes) != len(set(axes)): | ||
raise ValueError("duplicate value in 'axis'") | ||
if np.any([a < 0 or a >= self.ndim for a in axes]): | ||
raise ValueError("'axis' entry is out of bounds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe IndexError
?
exception IndexError
Raised when a sequence subscript is out of range. (Slice indices are silently truncated to fall in the allowed range; if an index is not an integer, TypeError is raised.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just copying ufunc behavior here:
>>> np.ones((2,3)).all(axis=8)
ValueError: 'axis' entry is out of bounds
OK, we'll go with it. Thanks Allan. |
Can this be backported to numpy 1.11.x?
|
@cgohlke Done. I wasn't planning on another release of 1.11.x, but could do. Currently there are also some enhancements in that branch as well as this bug fix so it will need some testing time before a release. The release schedule needs some discussion. |
Thank you. |
Follow up to #5706. Fixes #7509