diff --git a/py/compile.c b/py/compile.c index 3b6a264d61..86ec4d3a3c 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2308,6 +2308,10 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar } } else { normal_argument: + if (star_flags) { + compile_syntax_error(comp, args[i], "non-keyword arg after */**"); + return; + } if (n_keyword > 0) { compile_syntax_error(comp, args[i], "non-keyword arg after keyword arg"); return; diff --git a/tests/basics/python34.py b/tests/basics/python34.py index a23f347d64..d5cc59ad6c 100644 --- a/tests/basics/python34.py +++ b/tests/basics/python34.py @@ -20,6 +20,8 @@ def test_syntax(code): print("SyntaxError") test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can) test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can) +test_syntax("f(*a, b)") # can't have positional after * +test_syntax("f(**a, b)") # can't have positional after ** test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can) test_syntax("del ()") # can't delete empty tuple (in 3.6 we can) diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp index f497df3b80..590fc364f4 100644 --- a/tests/basics/python34.py.exp +++ b/tests/basics/python34.py.exp @@ -7,5 +7,7 @@ SyntaxError SyntaxError SyntaxError SyntaxError +SyntaxError +SyntaxError 3.4 3 4