From 88dce26da6bc4838092128d9a6f1c98bf48b7c90 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 30 Dec 2019 09:53:36 +0000 Subject: Fix handling of line numbers around finally-blocks. (#17737) --- Python/compile.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 98a4afa168..ce6f18a1f5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1686,7 +1686,11 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info, return 0; } } + /* Emit the finally block, restoring the line number when done */ + int saved_lineno = c->u->u_lineno; VISIT_SEQ(c, stmt, info->fb_datum); + c->u->u_lineno = saved_lineno; + c->u->u_lineno_set = 0; if (preserve_tos) { compiler_pop_fblock(c, POP_VALUE, NULL); } -- cgit v1.2.1