summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2019-07-08 21:17:56 (GMT)
committerIvan Levkivskyi <levkivskyi@gmail.com>2019-07-08 21:17:56 (GMT)
commit110a47c4f42cf4db88edc1876899fff8f05190fb (patch)
treeb649c1aa3583487925f65e2c4bcec5d71bb54f24 /Python/ast.c
parent66b4150f6f001640521ae6c9571cd4325cd67394 (diff)
downloadcpython-110a47c4f42cf4db88edc1876899fff8f05190fb.zip
cpython-110a47c4f42cf4db88edc1876899fff8f05190fb.tar.gz
cpython-110a47c4f42cf4db88edc1876899fff8f05190fb.tar.bz2
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.
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 16895ce..8dc86c2 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);