py: Add mp_obj_is_float function (macro) and use it where appropriate.
diff --git a/py/obj.c b/py/obj.c
index 34ecdab..9d77d25 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -268,7 +268,7 @@
return MP_OBJ_SMALL_INT_VALUE(arg);
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
return mp_obj_int_as_float(arg);
- } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
+ } else if (mp_obj_is_float(arg)) {
return mp_obj_float_get(arg);
} else {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
@@ -295,7 +295,7 @@
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
*real = mp_obj_int_as_float(arg);
*imag = 0;
- } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
+ } else if (mp_obj_is_float(arg)) {
*real = mp_obj_float_get(arg);
*imag = 0;
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_complex)) {