diff options
| author | Damien George <damien.p.george@gmail.com> | 2020-03-18 17:26:19 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2020-03-18 17:26:19 +1100 |
| commit | ad9a0ec8abc9d04b93b949831b7152f55ca0d7ac (patch) | |
| tree | f988445bbb8f1ef36b1ae69bfa6e60f4ed5d3d4e /py | |
| parent | 8f0778b2092a4af1b7109b997a3c9c14766e31e8 (diff) | |
all: Convert exceptions to use mp_raise_XXX helpers in remaining places.
Diffstat (limited to 'py')
| -rw-r--r-- | py/modbuiltins.c | 2 | ||||
| -rw-r--r-- | py/modmath.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 299ec2da7..f789cbaee 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -387,7 +387,7 @@ STATIC mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) { return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]); default: #if !MICROPY_PY_BUILTINS_POW3 - mp_raise_msg(&mp_type_NotImplementedError, "3-arg pow() not supported"); + mp_raise_NotImplementedError("3-arg pow() not supported"); #elif MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_MPZ return mp_binary_op(MP_BINARY_OP_MODULO, mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]), args[2]); #else diff --git a/py/modmath.c b/py/modmath.c index 5fe8e498c..52ad0b000 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -294,7 +294,7 @@ STATIC mp_obj_t mp_math_factorial_inner(mp_uint_t start, mp_uint_t end) { STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) { mp_int_t max = mp_obj_get_int(x_obj); if (max < 0) { - mp_raise_msg(&mp_type_ValueError, "negative factorial"); + mp_raise_ValueError("negative factorial"); } else if (max == 0) { return MP_OBJ_NEW_SMALL_INT(1); } @@ -308,7 +308,7 @@ STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) { STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) { mp_int_t max = mp_obj_get_int(x_obj); if (max < 0) { - mp_raise_msg(&mp_type_ValueError, "negative factorial"); + mp_raise_ValueError("negative factorial"); } else if (max <= 1) { return MP_OBJ_NEW_SMALL_INT(1); } |
