Skip to content

Duplicate keyword arguments should be a SyntaxError #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
OddBloke opened this issue Aug 31, 2018 · 4 comments · Fixed by #1407
Closed

Duplicate keyword arguments should be a SyntaxError #116

OddBloke opened this issue Aug 31, 2018 · 4 comments · Fixed by #1407
Assignees

Comments

@OddBloke
Copy link
Collaborator

We currently treat them as a TypeError, but CPython rejects them as invalid syntax.

(This issue will be introduced in #115, but is small enough for me to come back and fix it after that has landed.)

@OddBloke OddBloke self-assigned this Aug 31, 2018
@windelbouwman
Copy link
Contributor

@OddBloke did you find some time to look into this? Is this issue still relevant?

@apatrushev
Copy link

Looks like it is still relevant:

$ rustpython -c 'x=lambda a: None; x(a=1,a=2)'
[no output]
$ python -c 'x=lambda a: None; x(a=1,a=2)'
  File "<string>", line 1
SyntaxError: keyword argument repeated

@xarus01
Copy link
Contributor

xarus01 commented Sep 13, 2019

I'd like to give a try on this issue.
I guess constructor for PyFuncArgs needs to check if the key already exists and raise SyntaxError

@coolreader18
Copy link
Member

coolreader18 commented Sep 13, 2019

I think because it's a syntax error, you should do it in the compiler and check for the duplicates when you're compiling function arguments.

vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 23, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 25, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 26, 2019
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 a pull request may close this issue.

5 participants