Fix assert() usage.

This commit is contained in:
Paul Sokolovsky
2014-02-02 08:57:05 +02:00
parent 6964422cf4
commit ea2509d92c
3 changed files with 9 additions and 3 deletions

View File

@@ -91,7 +91,9 @@ static mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
#if MICROPY_ENABLE_SLICE
if (MP_OBJ_IS_TYPE(rhs, &slice_type)) {
machine_uint_t start, stop;
assert(m_seq_get_fast_slice_indexes(o->len, rhs, &start, &stop));
if (!m_seq_get_fast_slice_indexes(o->len, rhs, &start, &stop)) {
assert(0);
}
mp_obj_tuple_t *res = mp_obj_new_tuple(stop - start, NULL);
m_seq_copy(res->items, o->items + start, res->len, mp_obj_t);
return res;