8000 gh-108654: restore comprehension locals before handling exception by carljm · Pull Request #108659 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-108654: restore comprehension locals before handling exception #108659

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

Merged
merged 6 commits into from
Aug 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
  • Loading branch information
carljm and corona10 authored Aug 30, 2023
commit c8eb6bff5166e81f2b99256d199985e10b157848
8 changes: 6 additions & 2 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5697,7 +5697,9 @@ pop_inlined_comprehension_state(struct compiler *c, location loc,
// discard incomplete comprehension result (beneath exc on stack)
ADDOP_I(c, NO_LOCATION, SWAP, 2);
ADDOP(c, NO_LOCATION, POP_TOP);
restore_inlined_comprehension_locals(c, loc, state);
if (restore_inlined_comprehension_locals(c, loc, state) < 0) {
return ERROR;
}
ADDOP_I(c, NO_LOCATION, RERAISE, 0);
ADDOP(c, NO_LOCATION, POP_BLOCK);

Expand All @@ -5712,7 +5714,9 @@ pop_inlined_comprehension_state(struct compiler *c, location loc,
Py_CLEAR(state.temp_symbols);
}
if (state.pushed_locals) {
restore_inlined_comprehension_locals(c, loc, state);
if (restore_inlined_comprehension_locals(c, loc, state) < 0) {
return ERROR;
}
Py_CLEAR(state.pushed_locals);
}
if (state.fast_hidden) {
Expand Down
0