8000 bpo-39080: Starred Expression's column offset fix when inside a CALL by lysnikolaou · Pull Request #17645 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

bpo-39080: Starred Expression's column offset fix when inside a CALL #17645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
< 8000 span class="sr-only">Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Starred Expression's column offset fix when inside a CALL
  • Loading branch information
lysnikolaou committed Dec 17, 2019
commit dc1efbc73d1fa609a3068457e12182f743a07d47
6 changes: 6 additions & 0 deletions Lib/test/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,12 @@ def test_elif_stmt_start_position_with_else(self):
self.assertEqual(elif_stmt.lineno, 3)
self.assertEqual(elif_stmt.col_offset, 0)

def test_starred_expr_end_position_within_call(self):
node = ast.parse('f(*[0, 1])')
starred_expr = node.body[0].value.args[0]
self.assertEqual(starred_expr.end_lineno, 1)
self.assertEqual(starred_expr.end_col_offset, 9)

def test_literal_eval(self):
self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3])
self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42})
Expand Down
2 changes: 1 addition & 1 deletion Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
return NULL;
starred = Starred(e, Load, LINENO(chch),
chch->n_col_offset,
chch->n_end_lineno, chch->n_end_col_offset,
e->end_lineno, e->end_col_offset,
c->c_arena);
if (!starred)
return NULL;
Expand Down
0