Repository navigation
Preserve set semantics for iterator operands and repeated XOR values - #503
Closed
rupayon123 wants to merge 1 commit into
Closed
rupayon123 wants to merge 1 commit into
rupayon123 wants to merge 1 commit into
Conversation
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
IndexedSetnow preserves set semantics when intersection, difference or symmetric difference receives a one-shot iterator. Membership checks previously consumed the operand, and symmetric difference reused an exhausted iterator. In-place XOR also toggled duplicate values repeatedly and skipped values when given an iterator over itself.Snapshot iterator operands before repeated membership checks and deduplicate in-place XOR inputs. Reusable set/list operands retain their existing membership behavior. Existing output ordering is preserved.
Five regressions fail before the change. The full suite and module doctests pass afterward: 677 passed on Python 3.11.15. This does not duplicate PR494, which corrects multi-operand intersection/difference update semantics.
The backstory
This continues the explicitly AI-assisted utility-library investigation described in #502. These cases compare the public set-like API with Python's built-in set operations using ordinary one-shot iterables; they were not discovered in production usage.
AI assistance