diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-09-26 05:44:55 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-09-26 05:44:55 (GMT) |
commit | 00d4442979af67735b90a70d21168b14eb84b43e (patch) | |
tree | f8e974d8e9efd85039f4b64d6fb7bcb8c5c2f65c /Python/ast.c | |
parent | 9cd90ccaae9d3a874db56ec8cb25bf8aec30a2ce (diff) | |
parent | 58b53953f80f2b2c5a8583a04ce737acfb326def (diff) | |
download | cpython-00d4442979af67735b90a70d21168b14eb84b43e.zip cpython-00d4442979af67735b90a70d21168b14eb84b43e.tar.gz cpython-00d4442979af67735b90a70d21168b14eb84b43e.tar.bz2 |
merge 3.5 (#25131)
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index 7eab3c0..88fcd37 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2107,6 +2107,7 @@ ast_for_atom(struct compiling *c, const node *n) * (comp_for | (',' (test ':' test | '**' test))* [','])) | * ((test | '*' test) * (comp_for | (',' (test | '*' test))* [','])) ) */ + expr_ty res; ch = CHILD(n, 1); if (TYPE(ch) == RBRACE) { /* It's an empty dict. */ @@ -2118,12 +2119,12 @@ ast_for_atom(struct compiling *c, const node *n) (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == COMMA)) { /* It's a set display. */ - return ast_for_setdisplay(c, ch); + res = ast_for_setdisplay(c, ch); } else if (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == comp_for) { /* It's a set comprehension. */ - return ast_for_setcomp(c, ch); + res = ast_for_setcomp(c, ch); } else if (NCH(ch) > 3 - is_dict && TYPE(CHILD(ch, 3 - is_dict)) == comp_for) { @@ -2133,12 +2134,17 @@ ast_for_atom(struct compiling *c, const node *n) "dict comprehension"); return NULL; } - return ast_for_dictcomp(c, ch); + res = ast_for_dictcomp(c, ch); } else { /* It's a dictionary display. */ - return ast_for_dictdisplay(c, ch); + res = ast_for_dictdisplay(c, ch); } + if (res) { + res->lineno = LINENO(n); + res->col_offset = n->n_col_offset; + } + return res; } } default: |