diff options
author | Mark Shannon <mark@hotpy.org> | 2021-06-24 14:12:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 14:12:48 (GMT) |
commit | 18ba1ff6a4eb284aefb8d157d5e574d8326a395d (patch) | |
tree | f2946ccab40cc22fcff14acf464429f9a3a36c7d /Python/compile.c | |
parent | 599c07006a636b0a6904008534118a9ba3daf726 (diff) | |
download | cpython-18ba1ff6a4eb284aefb8d157d5e574d8326a395d.zip cpython-18ba1ff6a4eb284aefb8d157d5e574d8326a395d.tar.gz cpython-18ba1ff6a4eb284aefb8d157d5e574d8326a395d.tar.bz2 |
Make sure that line number is set correctly for call to __exit__ when handling exception in body of a with statement. (GH-26890)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c index 9118d12..52d2987 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5053,6 +5053,7 @@ compiler_visit_keyword(struct compiler *c, keyword_ty k) static int compiler_with_except_finish(struct compiler *c, basicblock * cleanup) { + c->u->u_lineno = -1; basicblock *exit; exit = compiler_new_block(c); if (exit == NULL) @@ -5168,7 +5169,6 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos) /* For exceptional outcome: */ compiler_use_next_block(c, final); - c->u->u_lineno = -1; ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); @@ -5265,7 +5265,6 @@ compiler_with(struct compiler *c, stmt_ty s, int pos) /* For exceptional outcome: */ compiler_use_next_block(c, final); - c->u->u_lineno = -1; ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); |