py: Remove implicit conversion of float to int in mp_obj_get_int().
Addresses Issue #199.
This commit is contained in:
parent
2843b8e3a7
commit
e6a4ab4be1
5
py/obj.c
5
py/obj.c
|
@ -177,11 +177,6 @@ machine_int_t mp_obj_get_int(mp_obj_t arg) {
|
||||||
return MP_OBJ_SMALL_INT_VALUE(arg);
|
return MP_OBJ_SMALL_INT_VALUE(arg);
|
||||||
} else if (MP_OBJ_IS_TYPE(arg, &int_type)) {
|
} else if (MP_OBJ_IS_TYPE(arg, &int_type)) {
|
||||||
return mp_obj_int_get_checked(arg);
|
return mp_obj_int_get_checked(arg);
|
||||||
#if MICROPY_ENABLE_FLOAT
|
|
||||||
} else if (MP_OBJ_IS_TYPE(arg, &float_type)) {
|
|
||||||
// TODO work out if this should be floor, ceil or trunc
|
|
||||||
return (machine_int_t)mp_obj_float_get(arg);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "can't convert %s to int", mp_obj_get_type_str(arg)));
|
nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "can't convert %s to int", mp_obj_get_type_str(arg)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue