diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-08 01:57:40 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-08 01:57:40 +0000 |
commit | 7d414a1b52d193bab2c94cf56932e1eba23ba542 (patch) | |
tree | 69f6840e4f825ffc1047fe7cb0f52eba27b20d86 /py/objcomplex.c | |
parent | 5f97aaeca4dc607a2d32e758c3ef6131ffb168a6 (diff) | |
download | micropython-7d414a1b52d193bab2c94cf56932e1eba23ba542.tar.gz micropython-7d414a1b52d193bab2c94cf56932e1eba23ba542.zip |
py: Parse big-int/float/imag constants directly in parser.
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103) and takes us a step closer to #722.
Diffstat (limited to 'py/objcomplex.c')
-rw-r--r-- | py/objcomplex.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objcomplex.c b/py/objcomplex.c index 6a403f6269..1415068438 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -95,7 +95,7 @@ STATIC mp_obj_t complex_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n // a string, parse it mp_uint_t l; const char *s = mp_obj_str_get_data(args[0], &l); - return mp_parse_num_decimal(s, l, true, true); + return mp_parse_num_decimal(s, l, true, true, NULL); } else if (MP_OBJ_IS_TYPE(args[0], &mp_type_complex)) { // a complex, just return it return args[0]; |