diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-11-06 16:01:48 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-11-06 16:01:48 (GMT) |
commit | c106c68aeb5814583a622587e63504f0c93c5140 (patch) | |
tree | b026a25fd175002dfa1e0cfba6168f7ccfa95b9f /Python/ast.c | |
parent | 0c009bf3b5c7fdcd2044acb3e8802d5db4bf19d7 (diff) | |
download | cpython-c106c68aeb5814583a622587e63504f0c93c5140.zip cpython-c106c68aeb5814583a622587e63504f0c93c5140.tar.gz cpython-c106c68aeb5814583a622587e63504f0c93c5140.tar.bz2 |
Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node when
compiling AST from Python objects.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/ast.c b/Python/ast.c index 5a7a745..77ebc83 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1181,11 +1181,9 @@ ast_for_arg(struct compiling *c, const node *n) return NULL; } - ret = arg(name, annotation, c->c_arena); + ret = arg(name, annotation, LINENO(n), n->n_col_offset, c->c_arena); if (!ret) return NULL; - ret->lineno = LINENO(n); - ret->col_offset = n->n_col_offset; return ret; } @@ -1241,11 +1239,10 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start, goto error; if (forbidden_name(c, argname, ch, 0)) goto error; - arg = arg(argname, annotation, c->c_arena); + arg = arg(argname, annotation, LINENO(ch), ch->n_col_offset, + c->c_arena); if (!arg) goto error; - arg->lineno = LINENO(ch); - arg->col_offset = ch->n_col_offset; asdl_seq_SET(kwonlyargs, j++, arg); i += 2; /* the name and the comma */ break; |