]> granicus.if.org Git - python/commitdiff
allow test node after ** in calls (closes #24176)
authorBenjamin Peterson <benjamin@python.org>
Sat, 16 May 2015 13:44:45 +0000 (09:44 -0400)
committerBenjamin Peterson <benjamin@python.org>
Sat, 16 May 2015 13:44:45 +0000 (09:44 -0400)
Grammar/Grammar
Lib/test/test_grammar.py
Modules/parsermodule.c
Python/graminit.c

index 4b193b949a84e0e22dc6f9fc1bfc79b8d23353c8..d129f6219a4e4958b6d303d15fe24d744277e423 100644 (file)
@@ -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
index e46a232677cfb0ac4531cc84b53d75de4857918b..2af73909f5879260d95a363e2cd6fd01ad74fe5f 100644 (file)
@@ -206,6 +206,7 @@ class GrammarTests(unittest.TestCase):
         d01(1)
         d01(*(1,))
         d01(**{'a':2})
+        d01(**{'a':2} or {})
         def d11(a, b=1): pass
         d11(1)
         d11(1, 2)
index 876e57d9ddc087442d5ad395415e7f34042aa7b3..2a16dbacc62c3fb55a16ee3a44331423ec3ba04a 100644 (file)
@@ -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));
index 8b236a44d1805811622d5723a681fe5b3ad6ef1c..14ac24f633c0124a1b137e9e8ce6686dcf6da3e3 100644 (file)
@@ -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},
@@ -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"},