Skip to content

Commit 73ca857

Browse files
authored
Revert ast.Starred (#1159)
1 parent 3f358a4 commit 73ca857

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Src/IronPython/Modules/_ast.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,8 @@ public Starred(expr value, expr_context ctx)
25032503
internal Starred(StarredExpression expr, expr_context ctx)
25042504
: this(Convert(expr.Value), ctx, null, null) { }
25052505

2506+
internal override AstExpression Revert() => new StarredExpression(value?.Revert());
2507+
25062508
public expr_context ctx { get; set; }
25072509

25082510
public expr value { get; set; }

Tests/test_ast.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,15 @@ def test_literal_eval_cp35572(self):
13381338
self.assertEqual(ast.literal_eval('-1.1'), -1.1)
13391339
self.assertEqual(ast.literal_eval('+1.1'), 1.1)
13401340

1341+
def test_ipy3_gh686(self):
1342+
"""https://github.com/IronLanguages/ironpython3/issues/686"""
1343+
# check that compiling ast.Starred works properly
1344+
x = ast.parse("*a, = [1]")
1345+
c = compile(x, "", "exec")
1346+
d = {}
1347+
exec(c, d)
1348+
self.assertEqual(d["a"], [1])
1349+
13411350
def main():
13421351
if __name__ != '__main__':
13431352
return

0 commit comments

Comments
 (0)