Repository navigation
Raise IndexError for out-of-range or negative sub_matrix indexes - #27
Open
CarlKCarlK wants to merge 1 commit into
Open
CarlKCarlK wants to merge 1 commit into
CarlKCarlK wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Closes #26.
sub_matrixnow checks row and column indexes before calling the Rust helper and raisesIndexErrornaming the first bad index. Before, an out-of-range index (or a negative one in an ndarray, which wrapped to a hugeuintp) made the Rust helper panic withPanicException, aBaseExceptionthatexcept Exceptiondoes not catch.Behavior change: a negative index in a Python list used to raise
OverflowError; it now raisesIndexErrorlike every other bad index. Valid indexes behave exactly as before.Validation
test_sub_matrix_bad_index(2-D and 3-D, lists and arrays, rows and columns); it fails without the fix.tests/test.py(legacy suite): 742 OK.ruff checkclean.PR #25 (CuPy support) adds the same
_checked_indexhelper for its CuPy path; whichever PR merges second keeps one copy.