-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Raise syntax error for mixing except
and except*
#14895
Conversation
|
It's not clear to me if it would be better to just put a single displayed error on the entire |
except
and except*
except
and except*
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 think the syntax error is fine the way it is. Thank you
This PR adds a syntax error if the parser encounters a `TryStmt` that has except clauses both with and without a star. The displayed error points to each except clause that contradicts the original except clause kind. So, for example, ```python try: .... except: #<-- we assume this is the desired except kind .... except*: #<--- error will point here .... except*: #<--- and here .... ``` Closes astral-sh#14860
This PR adds a syntax error if the parser encounters a
TryStmt
that has except clauses both with and without a star.The displayed error points to each except clause that contradicts the original except clause kind. So, for example,
Closes #14860