diff --git a/py/objrange.c b/py/objrange.c index 58d90a75e6..9d0ca37a74 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -148,9 +148,9 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { mp_seq_get_fast_slice_indexes(len, index, &slice); mp_obj_range_t *o = m_new_obj(mp_obj_range_t); o->base.type = &mp_type_range; - o->start = slice.start; - o->stop = slice.stop; - o->step = slice.step; + o->start = self->start + slice.start * self->step; + o->stop = self->start + slice.stop * self->step; + o->step = slice.step * self->step; return o; } #endif