diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2019-12-12 22:40:21 +0100 |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-12-12 13:40:21 -0800 |
commit | 025a602af7ee284d8db6955c26016f3f27d35536 (patch) | |
tree | f080f5fadbf276bc1dac0910c0ab9ecab81feeaa /Python/ast.c | |
parent | 1988344a6bff253f017e053f69318ecf03587294 (diff) | |
download | cpython-git-025a602af7ee284d8db6955c26016f3f27d35536.tar.gz |
bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582)
When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node.
https://bugs.python.org/issue39031
Automerge-Triggered-By: @pablogsal
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c index 417b347f98..c450b877f1 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4076,8 +4076,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) } asdl_seq_SET(newobj, 0, If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), - CHILD(n, off)->n_col_offset, + LINENO(CHILD(n, off - 1)), + CHILD(n, off - 1)->n_col_offset, end_lineno, end_col_offset, c->c_arena)); orelse = newobj; } |