mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
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.
(cherry picked from commit 110a47c4f4
)
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
This commit is contained in:
parent
54348f46f8
commit
c7be35c2ab
4 changed files with 34 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue