Repository navigation
Preserve BoxList comments with index protocol objects - #355
Merged
cdgriffith merged 1 commit intoNov 11, 2026
Merged
Conversation
Merged
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.
Fixes #354.
Normalize index-protocol objects once before
BoxList.insert,popand item deletion mutate the list. Reuse the resulting integer for comment bookkeeping, so valid__index__objects do not raise after a successful mutation and leave comments attached to the wrong items. Item deletion still delegates invalid non-index keys to list to preserve its existing error behavior. Slice and dotted-key paths stay unchanged.Five added source lines, including the import. Added 38 regression/control cases for all three operations, positive/negative/clamped/out-of-bounds indexes, with and without comments, invalid index conversion, and a stateful index that must be evaluated only once. Against unchanged develop
fa7ca67d16c5619f1f3f2c542284100abd3c1383, 14 cases fail and 24 controls pass. All 38 pass with the fix.Validation on Linux:
box_listloads from the compiled.so, then ran an isolated copy of the full tests: 733 passed, 1 skipped.boxmodules: passed.git diff --check: passed.Updated
CHANGES.rstandAUTHORS.rstas the contribution guide requests; targets develop, not master. No dependency, API or performance claim, release, or unrelated comment behavior change. Other platforms, PyPy, and the complete remote packaging matrix were not run locally.Found through source inspection and local reproduction, not a claimed production incident.