diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-08-12 08:00:06 +1200 |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-08-12 08:00:06 +1200 |
commit | 59040a0452fc468e0cc3c654187806958acc055a (patch) | |
tree | 043f777d04849785274b702c674ac373fcf71e90 /Grammar/Grammar | |
parent | 514070a919495a664a080da53452052fffe0ca97 (diff) | |
download | cpython-59040a0452fc468e0cc3c654187806958acc055a.tar.gz |
Issue #9232: Support trailing commas in function declarations.
For example, "def f(*, a = 3,): pass" is now legal.
Patch from Mark Dickinson.
Diffstat (limited to 'Grammar/Grammar')
-rw-r--r-- | Grammar/Grammar | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar index 99fcea026a..14bdecd0e2 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -27,13 +27,18 @@ async_funcdef: ASYNC funcdef funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' -typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' - ['*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef]] - | '*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef) +typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [ + '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]] + | '**' tfpdef [',']]] + | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]] + | '**' tfpdef [',']) tfpdef: NAME [':' test] -varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' - ['*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef]] - | '*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef) +varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [ + '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]] + | '**' vfpdef [',']]] + | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]] + | '**' vfpdef [','] +) vfpdef: NAME stmt: simple_stmt | compound_stmt |