diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-06-07 13:06:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 13:06:24 (GMT) |
commit | eca3f7762c23b22a73a5e0b09520748c88aab4a0 (patch) | |
tree | 2befe748f588288154385f9d56d3ceaead9055d7 /Python | |
parent | d68a22e7a68ae09f7db61d5a1a3bd9c0360cf3ee (diff) | |
download | cpython-eca3f7762c23b22a73a5e0b09520748c88aab4a0.zip cpython-eca3f7762c23b22a73a5e0b09520748c88aab4a0.tar.gz cpython-eca3f7762c23b22a73a5e0b09520748c88aab4a0.tar.bz2 |
gh-93691: fix too broad source locations of with-statement instructions (#120125)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 7d74096..cb72415 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5900,7 +5900,7 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos) /* Evaluate EXPR */ VISIT(c, expr, item->context_expr); - + loc = LOC(item->context_expr); ADDOP(c, loc, BEFORE_ASYNC_WITH); ADDOP_I(c, loc, GET_AWAITABLE, 1); ADDOP_LOAD_CONST(c, loc, Py_None); @@ -5998,7 +5998,7 @@ compiler_with(struct compiler *c, stmt_ty s, int pos) /* Evaluate EXPR */ VISIT(c, expr, item->context_expr); /* Will push bound __exit__ */ - location loc = LOC(s); + location loc = LOC(item->context_expr); ADDOP(c, loc, BEFORE_WITH); ADDOP_JUMP(c, loc, SETUP_WITH, final); @@ -6031,7 +6031,6 @@ compiler_with(struct compiler *c, stmt_ty s, int pos) /* For successful outcome: * call __exit__(None, None, None) */ - loc = LOC(s); RETURN_IF_ERROR(compiler_call_exit_with_nones(c, loc)); ADDOP(c, loc, POP_TOP); ADDOP_JUMP(c, loc, JUMP, exit); |