all: Raise exceptions via mp_raise_XXX

- Changed: ValueError, TypeError, NotImplementedError
  - OSError invocations unchanged, because the corresponding utility
    function takes ints, not strings like the long form invocation.
  - OverflowError, IndexError and RuntimeError etc. not changed for now
    until we decide whether to add new utility functions.
This commit is contained in:
Javier Candeira
2017-08-09 14:40:45 +10:00
parent b6a3289564
commit 35a1fea90b
41 changed files with 86 additions and 95 deletions

View File

@@ -188,7 +188,7 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_t ostart, ostop, ostep;
mp_obj_slice_get(index, &ostart, &ostop, &ostep);
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
mp_not_implemented("only slices with step=1 (aka None) are supported");
mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
}
const byte *pstart, *pstop;