summaryrefslogtreecommitdiff
path: root/extmod/modurandom.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-11 13:17:41 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-13 11:03:37 +1100
commit97eca38c4f03e76bd464fb25974544a043af2a9e (patch)
tree9141a63cb6e1e414330d0a93e11ceedc955f4c27 /extmod/modurandom.c
parent7679e3be96f7e0996faa89678beaf423d7c25999 (diff)
py: Add mp_raise_type helper macro and use it where appropriate.
This provides a more consistent C-level API to raise exceptions, ie moving away from nlr_raise towards mp_raise_XXX. It also reduces code size by a small amount on some ports.
Diffstat (limited to 'extmod/modurandom.c')
-rw-r--r--extmod/modurandom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/modurandom.c b/extmod/modurandom.c
index e3c7fc7f5..34fe1b749 100644
--- a/extmod/modurandom.c
+++ b/extmod/modurandom.c
@@ -154,7 +154,7 @@ STATIC mp_obj_t mod_urandom_choice(mp_obj_t seq) {
if (len > 0) {
return mp_obj_subscr(seq, mp_obj_new_int(yasmarang_randbelow(len)), MP_OBJ_SENTINEL);
} else {
- nlr_raise(mp_obj_new_exception(&mp_type_IndexError));
+ mp_raise_type(&mp_type_IndexError);
}
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_urandom_choice_obj, mod_urandom_choice);