Skip to content
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
int --> Py_ssize_t. renamed last_location_in_body --> location_of_las…
…t_executing_statement
  • Loading branch information
iritkatriel committed Oct 17, 2022
commit 8e7acf65999539a9a190e72ca4afb9b0afa0e559
8 changes: 4 additions & 4 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3272,9 +3272,9 @@ compiler_continue(struct compiler *c, location loc)


static location
last_location_in_body(asdl_stmt_seq *stmts)
location_of_last_executing_statement(asdl_stmt_seq *stmts)
{
for (int i = asdl_seq_LEN(stmts) - 1; i >= 0; i++) {
for (Py_ssize_t i = asdl_seq_LEN(stmts) - 1; i >= 0; i++) {
location loc = LOC((stmt_ty)asdl_seq_GET(stmts, i));
if (loc.lineno > 0) {
return loc;
Expand Down Expand Up @@ -3351,7 +3351,7 @@ compiler_try_finally(struct compiler *c, stmt_ty s)
if (!compiler_push_fblock(c, loc, FINALLY_END, end, NO_LABEL, NULL))
return 0;
VISIT_SEQ(c, stmt, s->v.Try.finalbody);
loc = last_location_in_body(s->v.Try.finalbody);
loc = location_of_last_executing_statement(s->v.Try.finalbody);
compiler_pop_fblock(c, FINALLY_END, end);

ADDOP_I(c, loc, RERAISE, 0); // CHANGED
Comment thread
iritkatriel marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -3404,7 +3404,7 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s)
return 0;
}
VISIT_SEQ(c, stmt, s->v.TryStar.finalbody);
loc = last_location_in_body(s->v.Try.finalbody);
loc = location_of_last_executing_statement(s->v.Try.finalbody);

compiler_pop_fblock(c, FINALLY_END, end);
ADDOP_I(c, loc, RERAISE, 0); // CHANGED
Expand Down