diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-07-08 21:41:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-08 21:41:34 (GMT) |
commit | c7be35c2abd598f02a633879133caec356593241 (patch) | |
tree | 4a1e5b6a7de8e105ef4d2295e63e83b68f167f28 /Python | |
parent | 54348f46f8c8c023b7e78f9cebe8e54818227b92 (diff) | |
download | cpython-c7be35c2abd598f02a633879133caec356593241.zip cpython-c7be35c2abd598f02a633879133caec356593241.tar.gz cpython-c7be35c2abd598f02a633879133caec356593241.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.
(cherry picked from commit 110a47c4f42cf4db88edc1876899fff8f05190fb)
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index 2a59415..317a42b 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); |