mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
This commit is contained in:
parent
1988344a6b
commit
025a602af7
3 changed files with 13 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue