Issue #14741: Fix missing support for ellipsis in parser module.
authorMark Dickinson <mdickinson@enthought.com>
Mon, 7 May 2012 16:24:04 +0000 (17:24 +0100)
committerMark Dickinson <mdickinson@enthought.com>
Mon, 7 May 2012 16:24:04 +0000 (17:24 +0100)
Lib/test/test_parser.py
Misc/NEWS
Modules/parsermodule.c

index 50dc8d14fdf45fdc4559cc5cdb0784d44e4586e3..cae09dfd32f5ad6f0edd194029bc06c81797ef1c 100644 (file)
@@ -106,6 +106,8 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
         self.check_expr("lambda x, *y, **z: 0")
         self.check_expr("(x for x in range(10))")
         self.check_expr("foo(x for x in range(10))")
+        self.check_expr("...")
+        self.check_expr("a[...]")
 
     def test_simple_expression(self):
         # expr_stmt
index 3da5cc09bc96d7eece25c14fa26129a9d597d362..e02489bcf055bd95b4af4e0f96d784f796656153 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -61,6 +61,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #14741: Fix missing support for Ellipsis ('...') in parser module.
+
 - Issue #14697: Fix missing support for set displays and set comprehensions in
   parser module.
 
index 05861ed3711e913333fb790907c8d204027e8c53..c0633e351d8cb8961793084cfc3325cda460c2d5 100644 (file)
@@ -2389,17 +2389,13 @@ validate_atom(node *tree)
             break;
           case NAME:
           case NUMBER:
+          case ELLIPSIS:
             res = (nch == 1);
             break;
           case STRING:
             for (pos = 1; res && (pos < nch); ++pos)
                 res = validate_ntype(CHILD(tree, pos), STRING);
             break;
-          case DOT:
-            res = (nch == 3 &&
-                   validate_ntype(CHILD(tree, 1), DOT) &&
-                   validate_ntype(CHILD(tree, 2), DOT));
-            break;
           default:
             res = 0;
             break;