Use a standard validator

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

View File

@ -55,9 +55,9 @@ mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, m
mp_obj_t ret_val;
// check radix base
if ((base != 0 && base < 2) || base > 36) {
if (base != 0) {
// this won't be reached if lex!=NULL
mp_raise_ValueError(MP_ERROR_TEXT("int() arg 2 must be >= 2 and <= 36"));
mp_arg_validate_int_range(base, 2, 36, MP_QSTR_base);
}
// skip leading space