Fix bug 1441408 where a double colon didn't trigger extended slice semantics (applies patch 1452332)
This commit is contained in:
parent
db815abc70
commit
77858684e4
20
Python/ast.c
20
Python/ast.c
|
@ -1317,16 +1317,20 @@ ast_for_slice(struct compiling *c, const node *n)
|
||||||
|
|
||||||
ch = CHILD(n, NCH(n) - 1);
|
ch = CHILD(n, NCH(n) - 1);
|
||||||
if (TYPE(ch) == sliceop) {
|
if (TYPE(ch) == sliceop) {
|
||||||
if (NCH(ch) == 1)
|
if (NCH(ch) == 1) {
|
||||||
/* XXX: If only 1 child, then should just be a colon. Should we
|
/* No expression, so step is None */
|
||||||
just skip assigning and just get to the return? */
|
ch = CHILD(ch, 0);
|
||||||
ch = CHILD(ch, 0);
|
step = Name(new_identifier("None", c->c_arena), Load,
|
||||||
else
|
LINENO(ch), ch->n_col_offset, c->c_arena);
|
||||||
ch = CHILD(ch, 1);
|
|
||||||
if (TYPE(ch) == test) {
|
|
||||||
step = ast_for_expr(c, ch);
|
|
||||||
if (!step)
|
if (!step)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
} else {
|
||||||
|
ch = CHILD(ch, 1);
|
||||||
|
if (TYPE(ch) == test) {
|
||||||
|
step = ast_for_expr(c, ch);
|
||||||
|
if (!step)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue