From 110a47c4f42cf4db88edc1876899fff8f05190fb Mon Sep 17 00:00:00 2001 From: Carl Friedrich Bolz-Tereick Date: Mon, 8 Jul 2019 23:17:56 +0200 Subject: bpo-18374: fix wrong col_offset of some ast.BinOp instances (GH-14607) Nested BinOp instances (e.g. a+b+c) had a wrong col_offset for the second BinOp (e.g. 2 instead of 0 in the example). Fix it by using the correct st node to copy the line and col_offset from in ast.c. --- Python/ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/ast.c') diff --git a/Python/ast.c b/Python/ast.c index 16895ce62e..8dc86c23d6 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2645,7 +2645,7 @@ ast_for_binop(struct compiling *c, const node *n) return NULL; tmp_result = BinOp(result, newoperator, tmp, - LINENO(next_oper), next_oper->n_col_offset, + LINENO(n), n->n_col_offset, CHILD(n, i * 2 + 2)->n_end_lineno, CHILD(n, i * 2 + 2)->n_end_col_offset, c->c_arena); -- cgit v1.2.3