Repository navigation
fix: CPY051 constructor calls, PPY019 comparison site, tombstone gaps - #70
Merged
Merged
Conversation
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.
Summary
Three precision fixes identified by independent senior-developer review before showing PyRift to CPython/PyPy contributors:
CPY051 — constructor call coverage:
_collect_module_mutablepreviously only detected mutable state created with literal syntax ([],{},set()). Module-levellist(),dict(),set(),bytearray(),collections.deque(),collections.defaultdict(), etc. were silently missed. The fix adds_is_mutable_constructor()and extends the value-check to cover both literals and constructor calls. +5 tests.PPY019 — finding at the right node: The rule previously fired at the
float('nan')creation site, causing false positives on any helper that creates a NaN object for downstream use. The fix rewrites the rule to walkast.Comparenodes and fire only when afloat('nan')call appears as an operand ofis/is not. Bare assignments are now a documented true negative. Test suite fully rewritten (+12 tests including true-negative cases).CLI explain — intentional gap messaging:
pyrift explain CPY058(and CPY059–CPY061) previously returned the genericunknown rule IDerror, indistinguishable from a typo. These slots were intentionally never assigned. The fix adds gap-range detection in_run_explainand returns a clear "intentional gap in the rule numbering" message with a pointer to CPY062. +5 tests.Test plan
pytest— 1811 passed, 0 failedruff check .— no issuesmypy pyrift/— no issuespyrift explain CPY058returns "intentional gap" messagepyrift explain CPY052still returns "retired rule" message_cache = list()+ mutation now triggers CPY051x = float('nan')(bare assignment) no longer triggers PPY019x is float('nan')triggers PPY019