mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
allow keyword args to be passed in after *args #3473
This commit is contained in:
parent
d9ccf8c547
commit
80f0ed5bb1
5 changed files with 29 additions and 12 deletions
|
|
@ -282,6 +282,14 @@ class GrammarTests(unittest.TestCase):
|
|||
def d32v((x,)): pass
|
||||
d32v((1,))
|
||||
|
||||
# keyword arguments after *arglist
|
||||
def f(*args, **kwargs):
|
||||
return args, kwargs
|
||||
self.assertEquals(f(1, x=2, *[3, 4], y=5), ((1, 3, 4),
|
||||
{'x':2, 'y':5}))
|
||||
self.assertRaises(SyntaxError, eval, "f(1, *(2,3), 4)")
|
||||
self.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)")
|
||||
|
||||
# Check ast errors in *args and *kwargs
|
||||
check_syntax_error(self, "f(*g(1=2))")
|
||||
check_syntax_error(self, "f(**g(1=2))")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue