objslice: Support arbitrary objects start, stop, and step.

Older int-only encoding is not expressive enough to support arbitrary slice
assignment operations.
This commit is contained in:
Paul Sokolovsky
2014-05-25 01:39:27 +03:00
parent 7a4ddd2428
commit afaaf535e6
5 changed files with 42 additions and 38 deletions

View File

@@ -355,6 +355,9 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (!mp_seq_get_fast_slice_indexes(self_len, index, &start, &stop)) {
assert(0);
}
if (start >= stop) {
return MP_OBJ_NEW_QSTR(MP_QSTR_);
}
return str_new(type, self_data + start, stop - start);
}
#endif