py/compile: Raise SyntaxError if positional args are given after */**.
In CPython 3.4 this raises a SyntaxError. In CPython 3.5+ having a positional after * is allowed but uPy has the wrong semantics and passes the arguments in the incorrect order. To prevent incorrect use of a function going unnoticed it is important to raise the SyntaxError in uPy, until the behaviour is fixed to follow CPython 3.5+.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user