diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2006-03-17 17:59:10 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2006-03-17 17:59:10 (GMT) |
commit | 77858684e4d66a373b63987856001929f1852b10 (patch) | |
tree | 919e92426331761d299a52637cd082dd8b35edd7 /Python/ast.c | |
parent | db815abc70a20f81c9de1c99b9089944c802c715 (diff) | |
download | cpython-77858684e4d66a373b63987856001929f1852b10.zip cpython-77858684e4d66a373b63987856001929f1852b10.tar.gz cpython-77858684e4d66a373b63987856001929f1852b10.tar.bz2 |
Fix bug 1441408 where a double colon didn't trigger extended slice semantics (applies patch 1452332)
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Python/ast.c b/Python/ast.c index bb1774b..3c339f0 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1317,16 +1317,20 @@ ast_for_slice(struct compiling *c, const node *n) ch = CHILD(n, NCH(n) - 1); if (TYPE(ch) == sliceop) { - if (NCH(ch) == 1) - /* XXX: If only 1 child, then should just be a colon. Should we - just skip assigning and just get to the return? */ - ch = CHILD(ch, 0); - else - ch = CHILD(ch, 1); - if (TYPE(ch) == test) { - step = ast_for_expr(c, ch); + if (NCH(ch) == 1) { + /* No expression, so step is None */ + ch = CHILD(ch, 0); + step = Name(new_identifier("None", c->c_arena), Load, + LINENO(ch), ch->n_col_offset, c->c_arena); if (!step) return NULL; + } else { + ch = CHILD(ch, 1); + if (TYPE(ch) == test) { + step = ast_for_expr(c, ch); + if (!step) + return NULL; + } } } |