diff options
author | Javier Candeira <javier@candeira.com> | 2017-08-09 14:40:45 +1000 |
---|---|---|
committer | Javier Candeira <javier@candeira.com> | 2017-08-13 22:52:33 +1000 |
commit | 35a1fea90b2cae9d5cc8e9eab62ba4c67e8786db (patch) | |
tree | 26616de189a9154309287846bf76fb1cdab8ce51 /extmod/modure.c | |
parent | b6a328956467339f568b19d9192fbbfdfa47a572 (diff) |
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.
Diffstat (limited to 'extmod/modure.c')
-rw-r--r-- | extmod/modure.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/modure.c b/extmod/modure.c index b85ba2673..2baebdecc 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -156,7 +156,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) { mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte*)subj.begin, caps[0] - subj.begin); mp_obj_list_append(retval, s); if (self->re.sub > 0) { - mp_not_implemented("Splitting with sub-captures"); + mp_raise_NotImplementedError("Splitting with sub-captures"); } subj.begin = caps[1]; if (maxsplit > 0 && --maxsplit == 0) { @@ -200,7 +200,7 @@ STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) { int error = re1_5_compilecode(&o->re, re_str); if (error != 0) { error: - nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Error in regex")); + mp_raise_ValueError("Error in regex"); } if (flags & FLAG_DEBUG) { re1_5_dumpcode(&o->re); |