Skip to content

bpo-40147: Move the check for duplicate keywords to the compiler#19289

Merged
pablogsal merged 2 commits into
python:masterfrom
pablogsal:bpo-40147
Apr 3, 2020
Merged

bpo-40147: Move the check for duplicate keywords to the compiler#19289
pablogsal merged 2 commits into
python:masterfrom
pablogsal:bpo-40147

Conversation

@pablogsal

@pablogsal pablogsal commented Apr 2, 2020

Copy link
Copy Markdown
Member

@pablogsal

Copy link
Copy Markdown
Member Author

As a bonus now we print the actual keyword that is repeated.

Before:

❯ python lel.py                       
  File "lel.py", line 1
    f(1, x=2, *(3, 4), x=5)
                       ^
SyntaxError: keyword argument repeated

After:

❯ ./python lel.py  
  File "/home/pablogsal/github/python/master/lel.py", line 1
    f(1, x=2, *(3, 4), x=5)
                       ^
SyntaxError: keyword argument repeated: x

@pablogsal

Copy link
Copy Markdown
Member Author

CC: @lysnikolaou

Comment thread Python/compile.c Outdated

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That was simpler than I expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants