BUG: MaskedArray.count treats negative axes incorrectly - #7515
Merged
Merged
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") |
Member
There was a problem hiding this comment.
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.)
Member
Author
There was a problem hiding this comment.
I'm just copying ufunc behavior here:
>>> np.ones((2,3)).all(axis=8)
ValueError: 'axis' entry is out of bounds
Member
|
OK, we'll go with it. Thanks Allan. |
Contributor
|
Can this be backported to numpy 1.11.x? |
Member
|
@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. |
Contributor
|
Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #5706. Fixes #7509