From afaaf535e6cfaf599432b13a2fbe9373e6a2c4b8 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 25 May 2014 01:39:27 +0300 Subject: objslice: Support arbitrary objects start, stop, and step. Older int-only encoding is not expressive enough to support arbitrary slice assignment operations. --- py/objstr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'py/objstr.c') diff --git a/py/objstr.c b/py/objstr.c index 4ec1034e1..67de2ce80 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -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 -- cgit v1.2.3