Repository navigation
Check normalized identifier names for duplicate arguments - #258
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
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.
Python normalizes identifiers with NFKC, so
def f(K, K): passhas a duplicate parameter andf(K=1, K=2)repeats a keyword argument. CPython rejects both, butgrammar.iter_errorscurrently returns no errors because the duplicate trackers compare the original spellings.Normalize the names when checking duplicate parameters and keyword arguments, and use that normalized spelling in the diagnostic. Source spelling and positions in the parse tree remain unchanged. This also covers lambda and keyword-only parameters; it does not case-fold identifiers.
Validation on Python 3.13.5:
master; four distinct-name controls pass.compileand checking source round trips.test_python_errors.pypass.git diff --checkpassed.Added the contributor entry requested by CONTRIBUTING.md. AI assistance: Codex prepared the change and tests; a separate agent inspected the diff and independently ran the 13 focused regressions. No human review or maintainer acceptance is claimed.