On python3 log(0) raises math domain error, not zerodivisionerror

This commit is contained in:
Jeff Epler 2022-11-08 15:26:46 -06:00
parent 0e19fbb60f
commit f67bca94c4
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 1 additions and 1 deletions

View File

@ -371,7 +371,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
#pragma GCC diagnostic ignored "-Wfloat-equal"
} else if (base == (mp_float_t)1.0) {
#pragma GCC diagnostic pop
mp_raise_msg(&mp_type_ZeroDivisionError, translate("division by zero"));
math_error();
}
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
}