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
Incorrect syntax error message for incorrect argument unpacking #110696
Comments
cc @pablogsal |
…ect argument unpacking
As for my question, it seems that # not allowed
func(a=5, 1, 2)
func(**{'a': 5}, 1, 2)
func(**{'a': 5}, *(1, 2))
# allowed
func(a=7, *(1, 2)) I might have to follow this up with a different issue. |
…ect argument unpacking (pythonGH-110706) (cherry picked from commit 3d18034) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
…ect argument unpacking (pythonGH-110706) (cherry picked from commit 3d18034) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
It was valid before (3.9 and older) so we cannot just make invalid now for backwards compatibility reasons. |
Bug report
Bug description:
I don't think
SyntaxError: iterable argument unpacking follows keyword argument unpacking
should be present in a case like this (minimal reproducible example):So it seems like if
*
is followed by code that triggers a genericSyntaxError: invalid syntax
error, the former error triggers and overshadows the generic error. This has somewhat made checking the error in the expression following that*
a bit harder.I have another question.
func(a=5, *b)
is apparently allowed but from the errorfunc(**{'a': 7}, *b)
isn't? I don't know what the PEP is for this so I'll try to search it up later.CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: