Skip to content

Allow UniqueList self-assignment for non-reflexive values - #65

Merged
wolph merged 1 commit into
wolph:developfrom
ShahadatTest:fix/unique-list-nan-self-assignment
Oct 29, 2026
Merged

wolph merged 1 commit into
wolph:developfrom
ShahadatTest:fix/unique-list-nan-self-assignment

Conversation

@ShahadatTest

Copy link
Copy Markdown
Contributor

UniqueList(nan, on_duplicate='raise')[0] = nan currently raises a duplicate error even though the same object remains in the same slot. NaN compares unequal to itself, so the equality-only check mistakes self-assignment for a duplicate elsewhere.

Check identity before inequality, matching the identity shortcut used by Python containers. Tests cover both duplicate modes and positive/negative indexes; assigning the same NaN into another occupied slot still raises. The class doctest also illustrates self-assignment.

Two regressions fail before the fix; three controls pass. Full Python 3.10 and 3.12 suites: 374 passed, 5 optional timezone-data skips, 100% branch/statement coverage. Whole-project mypy, basedpyright and Pyrefly report no errors. Ruff lint and formatting of changed files, plus git diff --check, pass. No matching open issue or PR found.

AI assistance: OpenAI Codex (GPT-6). Original user request: new 14ta koro aro (make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.

@wolph
wolph merged commit 45f4045 into wolph:develop Oct 29, 2026
17 checks passed
@wolph

wolph commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thank you for the fix! NaN not being equal to itself strikes again :)

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