sequence: Throw exception for not implemented slice steps.

This commit is contained in:
Paul Sokolovsky 2014-05-25 03:02:57 +03:00
parent 2705f4c782
commit ff4b6daa4f
1 changed files with 2 additions and 0 deletions

View File

@ -56,6 +56,8 @@ bool mp_seq_get_fast_slice_indexes(machine_uint_t len, mp_obj_t slice, machine_u
machine_int_t start, stop;
mp_obj_slice_get(slice, &ostart, &ostop, &ostep);
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError,
"Only slices with step=1 (aka None) are supported"));
return false;
}