aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/compile.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-08-17 21:51:59 +0300
committershadchin <shadchin@yandex-team.com>2024-08-17 22:04:51 +0300
commitee9edbd8878888bafcd0eeb3b528f3ec4311560b (patch)
treed54d8138e50a446904f10a2092719be86af011b7 /contrib/tools/python3/Python/compile.c
parent72cbe4bad58add0912623ba51351ff1db8587249 (diff)
downloadydb-ee9edbd8878888bafcd0eeb3b528f3ec4311560b.tar.gz
Update Python 3 to 3.12.5
https://docs.python.org/release/3.12.5/whatsnew/changelog.html#python-3-12-5-final de86cdeacd3a8653b9ec36e87975886fafcf6dc2
Diffstat (limited to 'contrib/tools/python3/Python/compile.c')
-rw-r--r--contrib/tools/python3/Python/compile.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/contrib/tools/python3/Python/compile.c b/contrib/tools/python3/Python/compile.c
index 40335f6dc3..81464a974f 100644
--- a/contrib/tools/python3/Python/compile.c
+++ b/contrib/tools/python3/Python/compile.c
@@ -2966,7 +2966,7 @@ compiler_lambda(struct compiler *c, expr_ty e)
co = optimize_and_assemble(c, 0);
}
else {
- location loc = LOCATION(e->lineno, e->lineno, 0, 0);
+ location loc = LOC(e->v.Lambda.body);
ADDOP_IN_SCOPE(c, loc, RETURN_VALUE);
co = optimize_and_assemble(c, 1);
}
@@ -3024,11 +3024,18 @@ compiler_for(struct compiler *c, stmt_ty s)
RETURN_IF_ERROR(compiler_push_fblock(c, loc, FOR_LOOP, start, end, NULL));
VISIT(c, expr, s->v.For.iter);
+
+ loc = LOC(s->v.For.iter);
ADDOP(c, loc, GET_ITER);
USE_LABEL(c, start);
ADDOP_JUMP(c, loc, FOR_ITER, cleanup);
+ /* Add NOP to ensure correct line tracing of multiline for statements.
+ * It will be removed later if redundant.
+ */
+ ADDOP(c, LOC(s->v.For.target), NOP);
+
USE_LABEL(c, body);
VISIT(c, expr, s->v.For.target);
VISIT_SEQ(c, stmt, s->v.For.body);
@@ -6110,7 +6117,7 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
break;
case YieldFrom_kind:
if (!_PyST_IsFunctionLike(c->u->u_ste)) {
- return compiler_error(c, loc, "'yield' outside function");
+ return compiler_error(c, loc, "'yield from' outside function");
}
if (c->u->u_scope_type == COMPILER_SCOPE_ASYNC_FUNCTION) {
return compiler_error(c, loc, "'yield from' inside async function");
@@ -7682,7 +7689,7 @@ optimize_and_assemble_code_unit(struct compiler_unit *u, PyObject *const_cache,
PyCodeObject *co = NULL;
PyObject *consts = consts_dict_keys_inorder(u->u_metadata.u_consts);
if (consts == NULL) {
- goto error;
+ return NULL;
}
cfg_builder g;
if (instr_sequence_to_cfg(&u->u_instr_sequence, &g) < 0) {