summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-09-14 16:06:08 (GMT)
committerGitHub <noreply@github.com>2023-09-14 16:06:08 (GMT)
commit4a54074a0f5579d417445ec28427cd0ed5aa01f4 (patch)
tree0422f3315f4acf1ad98152cd936b72df43e43b92 /Python
parent1ce9ea0453f7dc69dd41684f3bc9310259513de8 (diff)
downloadcpython-4a54074a0f5579d417445ec28427cd0ed5aa01f4.zip
cpython-4a54074a0f5579d417445ec28427cd0ed5aa01f4.tar.gz
cpython-4a54074a0f5579d417445ec28427cd0ed5aa01f4.tar.bz2
gh-105658: fix excess trace events for except block ending with a conditional block (#109384)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/Python/compile.c b/Python/compile.c
index b05c1ad..1d9ae62 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3261,18 +3261,6 @@ compiler_continue(struct compiler *c, location loc)
}
-static location
-location_of_last_executing_statement(asdl_stmt_seq *stmts)
-{
- 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;
- }
- }
- return NO_LOCATION;
-}
-
/* Code generated for "try: <body> finally: <finalbody>" is as follows:
SETUP_FINALLY L
@@ -3341,9 +3329,9 @@ compiler_try_finally(struct compiler *c, stmt_ty s)
RETURN_IF_ERROR(
compiler_push_fblock(c, loc, FINALLY_END, end, NO_LABEL, NULL));
VISIT_SEQ(c, stmt, s->v.Try.finalbody);
- loc = location_of_last_executing_statement(s->v.Try.finalbody);
compiler_pop_fblock(c, FINALLY_END, end);
+ loc = NO_LOCATION;
ADDOP_I(c, loc, RERAISE, 0);
USE_LABEL(c, cleanup);
@@ -3392,9 +3380,9 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s)
compiler_push_fblock(c, loc, FINALLY_END, end, NO_LABEL, NULL));
VISIT_SEQ(c, stmt, s->v.TryStar.finalbody);
- loc = location_of_last_executing_statement(s->v.Try.finalbody);
compiler_pop_fblock(c, FINALLY_END, end);
+ loc = NO_LOCATION;
ADDOP_I(c, loc, RERAISE, 0);
USE_LABEL(c, cleanup);