Repository navigation
Fix IndexedSet.pop integer-index validation - #535
Closed
harbinresearcher wants to merge 1 commit into
Closed
harbinresearcher wants to merge 1 commit into
harbinresearcher wants to merge 1 commit into
Conversation
This was referenced Oct 5, 2026
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
…tor set ops, complement & and ^ (mahmoud#577, mahmoud#535, mahmoud#494, mahmoud#503, mahmoud#516, mahmoud#487)
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.
The change
Normalize explicit
IndexedSet.pop()indices withoperator.index()beforecomparisons or mutation, matching the existing
__getitem__behavior. CurrentlyIndexedSet(range(4)).pop(3.0)silently removes the last element, while valid__index__objects are rejected or compared before normalization.Keep the existing
Nonedefault, integer/bool behavior, dead-slot mapping andcompaction unchanged. Regression coverage checks rejected indices leave state
intact and accepted indices agree with
list.pop()in dense/sparse layouts.The backstory
I'm contributing to learn and build open-source experience, and hadn't used
boltons before this contribution. This was found during a Codex-assisted source
audit, not in production:
__getitem__already uses the integer-index protocol,but the last-item shortcut in
pop()bypasses it.Verification
doctests 678 passed, 12 subtests passed.
12 subtests passed.
tox -e py314on Windows / Python 3.14.6 builds and installs thepackage, then passes all 707 tests/doctests (five unrelated deprecation warnings).
repeated the same full suite and
git diff --checksuccessfully.git diff --checkpasses. No dependency or unrelated changes.AI assistance