-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[syntax-errors] Parenthesized keyword argument names after Python 3.8 #16482
Conversation
Summary -- Unlike the other syntax errors detected so far, parenthesized keyword arguments are only allowed *before* 3.8. It sounds like they were only accidentally allowed before that [^1]. I wanted to mark the whole parenthesized range instead of just the kwarg name, so I moved the `ParsedExpr::is_parenthesized` bool to an `Option<TextRange>` and replaced it with an `is_parenthesized` method. Test Plan -- Inline tests. [^1]: python/cpython#78822
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still slightly prefer to not store the parenthesized range to make this PR smaller and avoid storing information that can be retrieved from the parser already but I'm happy to go with what you / @dhruvmanila think is best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
As suggested #16482 (comment), I'd get the argument range locally using node_range
and use that instead.
Summary
Unlike the other syntax errors detected so far, parenthesized keyword arguments are only allowed before 3.8. It sounds like they were only accidentally allowed before that 1.
As an aside, you get a pretty confusing error from Python for this, so it's nice that we can catch it:
Test Plan
Inline tests.
Footnotes
https://github.com/python/cpython/issues/78822 ↩