diff options
author | Mark Shannon <mark@hotpy.org> | 2019-12-30 09:53:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-30 09:53:36 +0000 |
commit | 88dce26da6bc4838092128d9a6f1c98bf48b7c90 (patch) | |
tree | 53ebe58d2faa02414576259e6e169dfeb84d5e4c /Python/compile.c | |
parent | 226e6e7d4326cf91ef37e13528eb1f62de1bb832 (diff) | |
download | cpython-git-88dce26da6bc4838092128d9a6f1c98bf48b7c90.tar.gz |
Fix handling of line numbers around finally-blocks. (#17737)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); } |