Repository navigation
Document drop index ordering and reset reused slice offsets - #2935
Merged
JohanMabille merged 2 commits intoOct 14, 2026
Merged
Conversation
allenflux
marked this pull request as ready for review
October 11, 2026 06:57
Contributor
Merging this PR will not alter performance
|
Member
|
Thanks for the fix! I think it would be better to require the indices to be sorted and let the user check that to avoid performance hit, what do you think? |
Document ordering after negative-index resolution and retain the repeated-normalization offset-map fix with its regression. Generated with OpenAI Codex
Member
|
Thanks again. The failure is unrelated to this PR. |
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.
Checklist
Description
Fixes #2595 by documenting the ordering precondition for
xt::drop: indices must be in increasing order after negative indices are resolved relative to the sliced axis. For an axis of size 6,drop(0, -1)resolves to{0, 5}, whereasdrop(-1, 0)is outside this contract. Callers ensure the order; the library performs no sorting or order check.Reset the cumulative offset map before rebuilding a reused drop slice. With
drop(-2, -1), normalization for axis sizes 4 and then 6 uses ordered positions in both cases, but an old offset entry makesslice(2)return 4 instead of 2. A single two-assertion regression covers this stale state. Existingkeepbehavior is unchanged.Validation on macOS arm64 with Apple Clang 21 and C++20:
test_xtensor_lib: 1,251 cases / 19,719 assertions pass, including optional JSON/MIME coverage; no cases skipped.test_xviewandtest_xdynamic_viewpass in Release, combined ASan/UBSan, and default column-major builds. Sanitizer coverage is limited to these related targets; leak detection is disabled on macOS and the existing CMake configuration disables signed-integer-overflow instrumentation.git diff --checkpass. Full Sphinx/Doxygen output was not built.The existing
xsortcompilation warnings and non-failingxinfotype-name warning remain unchanged. AI assistance was used for investigation, implementation, tests, validation, and this description. Duplicate and out-of-range indices remain outside this change's scope.