diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-01 17:03:35 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-01 17:03:35 +0000 |
commit | 209d1b18355836c382f7a1179f80207b14bca92a (patch) | |
tree | 288f4b0e467d1a6d43abf6f1e7d57464b0e19b1a /py/obj.c | |
parent | 31aa47d56a8ce46249c19ca2ea9975813e3c8ce6 (diff) | |
download | micropython-209d1b18355836c382f7a1179f80207b14bca92a.tar.gz micropython-209d1b18355836c382f7a1179f80207b14bca92a.zip |
py: add int() and float() built-ins, partially implemented.
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -144,8 +144,7 @@ machine_float_t mp_obj_get_float(mp_obj_t arg) { } else if (MP_OBJ_IS_TYPE(arg, &float_type)) { return mp_obj_float_get(arg); } else { - assert(0); - return 0; + nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "can't convert %s to float", mp_obj_get_type_str(arg))); } } @@ -165,9 +164,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { } else if (MP_OBJ_IS_TYPE(arg, &complex_type)) { mp_obj_complex_get(arg, real, imag); } else { - assert(0); - *real = 0; - *imag = 0; + nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "can't convert %s to complex", mp_obj_get_type_str(arg))); } } #endif |