Skip to content

Commit

Permalink
allow test node after ** in calls (closes python#24176)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminp committed May 16, 2015
1 parent 8de32d9 commit de12b79
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Grammar/Grammar
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ arglist: argument (',' argument)* [',']
# that precede iterable unpackings are blocked; etc.
argument: ( test [comp_for] |
test '=' test |
'**' expr |
'**' test |
star_expr )

comp_iter: comp_for | comp_if
Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def d01(a=1): pass
d01(1)
d01(*(1,))
d01(**{'a':2})
d01(**{'a':2} or {})
def d11(a, b=1): pass
d11(1)
d11(1, 2)
Expand Down
2 changes: 1 addition & 1 deletion Modules/parsermodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2871,7 +2871,7 @@ validate_argument(node *tree)

if (res) {
if (TYPE(CHILD(tree, 0)) == DOUBLESTAR) {
res = validate_expr(CHILD(tree, 1));
res = validate_test(CHILD(tree, 1));
}
else if (nch == 1) {
res = validate_test_or_star_expr(CHILD(tree, 0));
Expand Down
12 changes: 4 additions & 8 deletions Python/graminit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,24 +1748,20 @@ static arc arcs_78_0[3] = {
};
static arc arcs_78_1[3] = {
{164, 3},
{31, 4},
{31, 2},
{0, 1},
};
static arc arcs_78_2[1] = {
{107, 3},
{26, 3},
};
static arc arcs_78_3[1] = {
{0, 3},
};
static arc arcs_78_4[1] = {
{26, 3},
};
static state states_78[5] = {
static state states_78[4] = {
{3, arcs_78_0},
{3, arcs_78_1},
{1, arcs_78_2},
{1, arcs_78_3},
{1, arcs_78_4},
};
static arc arcs_79_0[2] = {
{164, 1},
Expand Down Expand Up @@ -2021,7 +2017,7 @@ static dfa dfas[85] = {
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"},
{333, "arglist", 0, 3, states_77,
"\000\040\200\000\006\000\000\000\000\000\004\000\000\000\010\001\000\140\110\224\017\000"},
{334, "argument", 0, 5, states_78,
{334, "argument", 0, 4, states_78,
"\000\040\200\000\006\000\000\000\000\000\004\000\000\000\010\001\000\140\110\224\017\000"},
{335, "comp_iter", 0, 2, states_79,
"\000\000\000\000\000\000\000\000\000\000\000\000\021\000\000\000\000\000\000\000\000\000"},
Expand Down

0 comments on commit de12b79

Please sign in to comment.