summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-28 14:07:21 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-28 14:07:21 +0100
commit503d6110338ab2d79e6c0f8f591a0ca6397717de (patch)
treebb57f7338aa07d248fb17cc6260d1f36c8bb8b86 /py/runtime.c
parent1d567592b18ea9796515436754877aac3948bd29 (diff)
downloadmicropython-503d6110338ab2d79e6c0f8f591a0ca6397717de.tar.gz
micropython-503d6110338ab2d79e6c0f8f591a0ca6397717de.zip
py: Implement long int parsing in int(...).
Addresses issue #627.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index ea75280ce4..f487807256 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -98,6 +98,13 @@ void mp_deinit(void) {
#endif
}
+mp_obj_t mp_load_const_int(qstr qstr) {
+ DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
+ uint len;
+ const byte* data = qstr_data(qstr, &len);
+ return mp_parse_num_integer((const char*)data, len, 0);
+}
+
mp_obj_t mp_load_const_dec(qstr qstr) {
DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
uint len;
@@ -1147,8 +1154,8 @@ void *m_malloc_fail(int num_bytes) {
// these must correspond to the respective enum
void *const mp_fun_table[MP_F_NUMBER_OF] = {
+ mp_load_const_int,
mp_load_const_dec,
- mp_obj_new_int_from_qstr,
mp_load_const_str,
mp_load_name,
mp_load_global,