From 9a56912ad16065c8fc3670c8d493f922bc54e5b1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 23 Nov 2015 16:50:42 +0000 Subject: py/compile: Do proper checking of * and ** in function definition. This patch checks that there is only one *, and that ** is last in the arg list. --- tests/basics/syntaxerror.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/basics/syntaxerror.py b/tests/basics/syntaxerror.py index 24c3fe6e4..2ae0183f8 100644 --- a/tests/basics/syntaxerror.py +++ b/tests/basics/syntaxerror.py @@ -113,3 +113,11 @@ test_syntax('def f(x):\n nonlocal x') # can define variable to be both nonlocal and global test_syntax('def f():\n nonlocal x\n global x') + +# can't have multiple *'s +test_syntax('def f(x, *a, *):\n pass') +test_syntax('lambda x, *a, *: 1') + +# **kw must be last +test_syntax('def f(x, *a, **kw, r):\n pass') +test_syntax('lambda x, *a, **kw, r: 1') -- cgit v1.2.3