-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bpo-45834: Move runtime 'except:' check to the parser #29625
Conversation
LGTM based on the tests but I’m not a good reviewer for the parser. |
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.
LGTM!
if (!handler->v.ExceptHandler.type && i < n-1) { | ||
return compiler_error(c, "default 'except:' must be last"); | ||
} | ||
assert(handler->v.ExceptHandler.type || i >= n-1); |
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.
Do we also need to add this check to the AST validator? (since it might lead to crashes when compiling manually crafted AST objects).
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.
Yup, what makes me think that maybe this change is not worth it because I find this PR much more complex than what we currently have
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.
Before making a decision about this PR, could you please look at the parser change for except* on #29581 ?
Let's close this if it's not worth doing. |
https://bugs.python.org/issue45834