| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,6 +146,12 @@ def test_snippets(self): | |||
| 146 | 146 | self.assertEquals(to_tuple(ast_tree), o) | |
| 147 | 147 | self._assert_order(ast_tree, (0, 0)) | |
| 148 | 148 | ||
| 149 | + def test_slice(self): | ||
| 150 | + slc = ast.parse("x[::]").body[0].value.slice | ||
| 151 | + self.assertIsNone(slc.upper) | ||
| 152 | + self.assertIsNone(slc.lower) | ||
| 153 | + self.assertIsNone(slc.step) | ||
| 154 | + | ||
| 149 | 155 | def test_nodeclasses(self): | |
| 150 | 156 | x = ast.BinOp(1, 2, 3, lineno=0) | |
| 151 | 157 | self.assertEquals(x.left, 1) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1 | |||
| 12 | 12 | Core and Builtins | |
| 13 | 13 | ----------------- | |
| 14 | 14 | ||
| 15 | + - In the slice AST type, the step field will always be None if a step expression | ||
| 16 | + is not specified. | ||
| 17 | + | ||
| 15 | 18 | - Issue #4547: When debugging a very large function, it was not always | |
| 16 | 19 | possible to update the lineno attribute of the current frame. | |
| 17 | 20 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1468,14 +1468,7 @@ ast_for_slice(struct compiling *c, const node *n) | |||
| 1468 | 1468 | ||
| 1469 | 1469 | ch = CHILD(n, NCH(n) - 1); | |
| 1470 | 1470 | if (TYPE(ch) == sliceop) { | |
| 1471 | - if (NCH(ch) == 1) { | ||
| 1472 | - /* No expression, so step is None */ | ||
| 1473 | - ch = CHILD(ch, 0); | ||
| 1474 | - step = Name(new_identifier("None", c->c_arena), Load, | ||
| 1475 | - LINENO(ch), ch->n_col_offset, c->c_arena); | ||
| 1476 | - if (!step) | ||
| 1477 | - return NULL; | ||
| 1478 | - } else { | ||
| 1471 | + if (NCH(ch) != 1) { | ||
| 1479 | 1472 | ch = CHILD(ch, 1); | |
| 1480 | 1473 | if (TYPE(ch) == test) { | |
| 1481 | 1474 | step = ast_for_expr(c, ch); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments