-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add support for except* handling and starred subscripts
#6522
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
except* handling and starred subscripts
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.
Tests are good. Move it to append to builtin_exceptions.py
|
@copilot try again |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
|
@copilot CPython doesnt pass |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Updated the check to avoid identity comparison so it now passes under CPython too (commit fbcf0b8). |
| } else { | ||
| // VISIT(c, expr, e->v.Subscript.slice) | ||
| self.compile_expression(slice)?; | ||
| match slice { |
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 don't see this logic in CPython:
https://github.com/python/cpython/blob/627894459a84be3488a1789919679c997056a03c/Python/compile.c#L6669-L6678
Assuming that this works, I'd like to have a comment explaining why we are deviating from the CPython logic
| Ok(()) | ||
| } | ||
|
|
||
| fn compile_try_star_statement( |
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.
| fn compile_try_star_statement( | |
| fn compile_try_star_except( |
| let handler_block = self.new_block(); | ||
| let finally_block = self.new_block(); | ||
|
|
||
| if !finalbody.is_empty() { |
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'd rather have it split like CPython does it
This makes it easier to maintain when looking for the diff between our impl and theirs
|
@copilot Address change request of @ShaharNaveh |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Addressed Shahar’s request by adopting a named constant for the duplicated stack copy in the except* codegen (commit 9b94189). |
|
hmm, probably copilot only reads change request by me |
Oof:/ |
|
not worth to do. I doubt copilot can finish this size one |
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.