Repository navigation
fix: put new axes in the right place when indexing GCXS after an integer index - #983
Merged
hameerabbasi merged 1 commit intoOct 9, 2026
Conversation
Merged
4 of 10 tasks
Contributor
Author
|
codecov/project fails on every PR (target 100%; codecov/patch passes here), and the benchmarks job fails on main too ( |
hameerabbasi
approved these changes
Oct 9, 2026
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.
What type of PR is this? (check all applicable)
Related issues
Checklist
Please explain your changes below.
Indexing a GCXS array with
Noneafter an integer index puts the new axis in the wrong place, or fails:getitemre-inserts theNoneaxes at their position in the key, but integer indices drop an axis, so the position in the result is the number of non-integer entries before it. That count is now used. Two more cases are handled: when the result before adding the new axes is 1-d it has noindptr, so the new axes are added by reshaping that 1-d GCXS array instead of building a 2-d one without an index pointer; and a key that is all integers plusNone(e.g.s2[1, None, 2]) now returns the element in an array of shape(1,),(1, 1), ... instead of failing.Tests: added the new cases to
test_slicing(3-d, all compressed axes) and atest_slicing_new_axes_2dtest. 46 of theslicing/advanced_indexingcases intest_compressed.pyfail on main and all pass here. A comparison with NumPy over ~11,000 keys built fromNone, integers, slices, a list andEllipsison 2-d and 3-d arrays with every choice of compressed axes has no mismatches, apart from the separate case where NumPy moves the advanced-index axis to the front because an integer and a list are separated by a slice orNone(COO behaves the same way there; not changed here).test_compressed.py,test_compressed_2d.py,test_compressed_slicing.py,test_compressed_convert.pyandtest_array_function.pypass (1900 passed), and pre-commit (ruff check/format) is clean.