py/parsenum: Optimise when building with complex disabled.

To reduce code size when MICROPY_PY_BUILTINS_COMPLEX is disabled.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-06-22 10:37:48 +10:00
parent 61ce260ff7
commit 627ba38154
7 changed files with 33 additions and 14 deletions

View File

@@ -137,7 +137,7 @@ STATIC mp_obj_t float_make_new(const mp_obj_type_t *type_in, size_t n_args, size
mp_buffer_info_t bufinfo;
if (mp_get_buffer(args[0], &bufinfo, MP_BUFFER_READ)) {
// a textual representation, parse it
return mp_parse_num_decimal(bufinfo.buf, bufinfo.len, false, false, NULL);
return mp_parse_num_float(bufinfo.buf, bufinfo.len, false, NULL);
} else if (mp_obj_is_float(args[0])) {
// a float, just return it
return args[0];