all: Use MP_ERROR_TEXT for all error messages.
This commit is contained in:
committed by
Damien George
parent
85858e72df
commit
def76fe4d9
@@ -36,7 +36,7 @@
|
||||
#define MP_PI MICROPY_FLOAT_CONST(3.14159265358979323846)
|
||||
|
||||
STATIC NORETURN void math_error(void) {
|
||||
mp_raise_ValueError("math domain error");
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("math domain error"));
|
||||
}
|
||||
|
||||
STATIC mp_obj_t math_generic_1(mp_obj_t x_obj, mp_float_t (*f)(mp_float_t)) {
|
||||
@@ -223,7 +223,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
|
||||
if (base <= (mp_float_t)0.0) {
|
||||
math_error();
|
||||
} else if (base == (mp_float_t)1.0) {
|
||||
mp_raise_msg(&mp_type_ZeroDivisionError, "divide by zero");
|
||||
mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("divide by zero"));
|
||||
}
|
||||
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
|
||||
}
|
||||
@@ -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_ValueError("negative factorial");
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("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_ValueError("negative factorial");
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("negative factorial"));
|
||||
} else if (max <= 1) {
|
||||
return MP_OBJ_NEW_SMALL_INT(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user