py/runtime: Allow multiple **args in a function call.
This is a partial implementation of PEP 448 to allow multiple ** unpackings when calling a function or method. The compiler is modified to encode the argument as a None: obj key-value pair (similar to how regular keyword arguments are encoded as str: obj pairs). The extra object that was pushed on the stack to hold a single ** unpacking object is no longer used and is removed. The runtime is modified to decode this new format. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
bb70874111
commit
1e99d29f36
@@ -25,7 +25,6 @@ def test_syntax(code):
|
||||
except SyntaxError:
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user