You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect syntax error message for incorrect argument unpacking #110696
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 generic SyntaxError: 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 error func(**{'a': 7}, *b) isn't? I don't know what the PEP is for this so I'll try to search it up later.
Activity
Eclips4 commentedon Oct 11, 2023
cc @pablogsal
pythongh-110696: Fix incorrect syntax error message for incorrect arg…
[-]Wrong error message?[/-][+]Incorrect syntax error message for incorrect argument unpacking[/+]fixup! pythongh-110696: Fix incorrect syntax error message for incorr…
gh-110696: Fix incorrect syntax error message for incorrect argument …
thatbirdguythatuknownot commentedon Oct 12, 2023
As for my question, it seems that
func(a=5, *b)shouldn't be valid? All the other alternative ways to write it are invalid syntax.I might have to follow this up with a different issue.
[3.12] pythongh-110696: Fix incorrect syntax error message for incorr…
[3.11] pythongh-110696: Fix incorrect syntax error message for incorr…
pablogsal commentedon Oct 12, 2023
It was valid before (3.9 and older) so we cannot just make invalid now for backwards compatibility reasons.
[3.12] gh-110696: Fix incorrect syntax error message for incorrect ar…
fixup! [3.11] pythongh-110696: Fix incorrect syntax error message for…
[3.11] gh-110696: Fix incorrect syntax error message for incorrect ar…
pythongh-110696: Fix incorrect syntax error message for incorrect arg…