aboutsummaryrefslogtreecommitdiff
path: root/py/objint.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-08 01:57:40 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-08 01:57:40 +0000
commit7d414a1b52d193bab2c94cf56932e1eba23ba542 (patch)
tree69f6840e4f825ffc1047fe7cb0f52eba27b20d86 /py/objint.c
parent5f97aaeca4dc607a2d32e758c3ef6131ffb168a6 (diff)
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/objint.c')
-rw-r--r--py/objint.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objint.c b/py/objint.c
index fd0b2be55..4a4a21aaf 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -57,7 +57,7 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_
// a string, parse it
mp_uint_t l;
const char *s = mp_obj_str_get_data(args[0], &l);
- return mp_parse_num_integer(s, l, 0);
+ return mp_parse_num_integer(s, l, 0, NULL);
#if MICROPY_PY_BUILTINS_FLOAT
} else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) {
return mp_obj_new_int_from_float(mp_obj_float_get(args[0]));
@@ -73,7 +73,7 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_
// TODO proper error checking of argument types
mp_uint_t l;
const char *s = mp_obj_str_get_data(args[0], &l);
- return mp_parse_num_integer(s, l, mp_obj_get_int(args[1]));
+ return mp_parse_num_integer(s, l, mp_obj_get_int(args[1]), NULL);
}
}
}