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

@@ -83,7 +83,7 @@ STATIC mp_obj_t complex_make_new(const mp_obj_type_t *type_in, size_t n_args, si
// a string, parse it
size_t l;
const char *s = mp_obj_str_get_data(args[0], &l);
return mp_parse_num_decimal(s, l, true, true, NULL);
return mp_parse_num_complex(s, l, NULL);
} else if (mp_obj_is_type(args[0], &mp_type_complex)) {
// a complex, just return it
return args[0];