summaryrefslogtreecommitdiffstatshomepage
path: root/py/objtuple.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-25 21:21:57 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-25 21:21:57 +0300
commitde4b9329f99794dc2025a7f9aa203811a156b3c4 (patch)
treecda613e8734bd7821f5ab1380558c103e8f2bbcb /py/objtuple.c
parentff4b6daa4f446094361c6bd4cfa557f0ad2565fc (diff)
downloadmicropython-de4b9329f99794dc2025a7f9aa203811a156b3c4.tar.gz
micropython-de4b9329f99794dc2025a7f9aa203811a156b3c4.zip
py: Refactor slice helpers, preparing to support arbitrary slicing.
Diffstat (limited to 'py/objtuple.c')
-rw-r--r--py/objtuple.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/objtuple.c b/py/objtuple.c
index b56c6433f6..ffc94b5d27 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -163,12 +163,12 @@ mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_tuple_t *self = self_in;
#if MICROPY_PY_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
- machine_uint_t start, stop;
- if (!mp_seq_get_fast_slice_indexes(self->len, index, &start, &stop)) {
+ mp_bound_slice_t slice;
+ if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
assert(0);
}
- mp_obj_tuple_t *res = mp_obj_new_tuple(stop - start, NULL);
- mp_seq_copy(res->items, self->items + start, res->len, mp_obj_t);
+ mp_obj_tuple_t *res = mp_obj_new_tuple(slice.stop - slice.start, NULL);
+ mp_seq_copy(res->items, self->items + slice.start, res->len, mp_obj_t);
return res;
}
#endif