cpython: 2b1cc84bf1d9 (original) (raw)
Mercurial > cpython
changeset 76824:2b1cc84bf1d9 3.2
Issue #14741: Fix missing support for ellipsis in parser module. [#14741]
Mark Dickinson mdickinson@enthought.com | |
---|---|
date | Mon, 07 May 2012 17:24:04 +0100 |
parents | 129289144dfb |
children | d50577c5711b 197f47238753 |
files | Lib/test/test_parser.py Misc/NEWS Modules/parsermodule.c |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-)[+] [-] Lib/test/test_parser.py 2 Misc/NEWS 2 Modules/parsermodule.c 6 |
line wrap: on
line diff
--- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -106,6 +106,8 @@ class RoundtripLegalSyntaxTestCase(unitt 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("...")[](#l1.7)
self.check_expr("a[...]")[](#l1.8)
def test_simple_expression(self): # expr_stmt
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -61,6 +61,8 @@ Core and Builtins Library ------- +- Issue #14741: Fix missing support for Ellipsis ('...') in parser module. +
--- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -2389,17 +2389,13 @@ validate_atom(node *tree) break; case NAME: case NUMBER:
case ELLIPSIS:[](#l3.7) res = (nch == 1);[](#l3.8) break;[](#l3.9) case STRING:[](#l3.10) for (pos = 1; res && (pos < nch); ++pos)[](#l3.11) res = validate_ntype(CHILD(tree, pos), STRING);[](#l3.12) break;[](#l3.13)
case DOT:[](#l3.14)
res = (nch == 3 &&[](#l3.15)
validate_ntype(CHILD(tree, 1), DOT) &&[](#l3.16)
validate_ntype(CHILD(tree, 2), DOT));[](#l3.17)
break;[](#l3.18) default:[](#l3.19) res = 0;[](#l3.20) break;[](#l3.21)