Skip to content

Preserve set semantics for iterator operands and repeated XOR values - #503

Closed
rupayon123 wants to merge 1 commit into
mahmoud:masterfrom
rupayon123:contribution/xor-iterables-20260916
Closed

rupayon123 wants to merge 1 commit into
mahmoud:masterfrom
rupayon123:contribution/xor-iterables-20260916

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

The change

IndexedSet now 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

  • Harness/tooling: OpenAI Codex acting on behalf of rupayon123.
  • Model: GPT-6-based Codex; exact backend variant not exposed.
  • Original task excerpt: “Execute my daily GitHub contribution and maintenance workflow on my behalf. Do real, verified work, not only research, a plan, configuration changes, or a status summary.” The task requires reproducible fixes, duplicate checking, and appropriate validation before submission.

@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

@mahmoud mahmoud closed this Oct 25, 2026
blebo pushed a commit to blebo/boltons that referenced this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants