diff --git a/py/obj.c b/py/obj.c
index 5601a73fe7a64f046671d9e2dc2c8ace8740d386..1d0c80ab907bba9198fc363e5b3ca7a520b82124 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -271,8 +271,10 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) {
         return 1;
     } else if (MP_OBJ_IS_SMALL_INT(arg)) {
         return MP_OBJ_SMALL_INT_VALUE(arg);
+    #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
     } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
-        return mp_obj_int_as_float(arg);
+        return mp_obj_int_as_float_impl(arg);
+    #endif
     } else if (mp_obj_is_float(arg)) {
         return mp_obj_float_get(arg);
     } else {
@@ -296,9 +298,11 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
     } else if (MP_OBJ_IS_SMALL_INT(arg)) {
         *real = MP_OBJ_SMALL_INT_VALUE(arg);
         *imag = 0;
+    #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
     } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
-        *real = mp_obj_int_as_float(arg);
+        *real = mp_obj_int_as_float_impl(arg);
         *imag = 0;
+    #endif
     } else if (mp_obj_is_float(arg)) {
         *real = mp_obj_float_get(arg);
         *imag = 0;
diff --git a/py/obj.h b/py/obj.h
index 61db65a9a2ff1f2f51a6a5c7bef5b8c8390e9215..6106bbe19ad1a9a9e91e420b92e174aa3cfc2ab9 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -680,9 +680,6 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
 mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in);
 // Will raise exception if value doesn't fit into mp_int_t
 mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
-#if MICROPY_PY_BUILTINS_FLOAT
-mp_float_t mp_obj_int_as_float(mp_obj_t self_in);
-#endif
 
 // exception
 #define mp_obj_is_native_exception_instance(o) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)
diff --git a/py/objint.c b/py/objint.c
index 3af509b53542c6b3affd9d01e7c4ec03cbafec2d..1c73141bd9e3b003ed29a781c8fdb1cb4a542014 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -354,12 +354,6 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
     return MP_OBJ_SMALL_INT_VALUE(self_in);
 }
 
-#if MICROPY_PY_BUILTINS_FLOAT
-mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
-    return MP_OBJ_SMALL_INT_VALUE(self_in);
-}
-#endif
-
 #endif // MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
 
 // This dispatcher function is expected to be independent of the implementation of long int
diff --git a/py/objint.h b/py/objint.h
index 6e627f1bd7f7fe72d8401f4c056f202ee1d88d1c..f418c329e9ed2f157adc08a183376c0f48d85e39 100644
--- a/py/objint.h
+++ b/py/objint.h
@@ -48,6 +48,7 @@ typedef enum {
 } mp_fp_as_int_class_t;
 
 mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val);
+mp_float_t mp_obj_int_as_float_impl(mp_obj_t self_in);
 #endif // MICROPY_PY_BUILTINS_FLOAT
 
 size_t mp_int_format_size(size_t num_bits, int base, const char *prefix, char comma);
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index b051cfbe6451ddf9f60d65292bc0d5839110e89a..f5b5d9c939928720258b15b34cfad5877ccf9f0f 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -295,13 +295,10 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
 }
 
 #if MICROPY_PY_BUILTINS_FLOAT
-mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
-    if (MP_OBJ_IS_SMALL_INT(self_in)) {
-        return MP_OBJ_SMALL_INT_VALUE(self_in);
-    } else {
-        mp_obj_int_t *self = self_in;
-        return self->val;
-    }
+mp_float_t mp_obj_int_as_float_impl(mp_obj_t self_in) {
+    assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
+    mp_obj_int_t *self = self_in;
+    return self->val;
 }
 #endif
 
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 0a1d68598d69e4871724b96dfe30065681373160..eadf64fce7664abafc1a27a66461bdab714b2caf 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -403,13 +403,10 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
 }
 
 #if MICROPY_PY_BUILTINS_FLOAT
-mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
-    if (MP_OBJ_IS_SMALL_INT(self_in)) {
-        return MP_OBJ_SMALL_INT_VALUE(self_in);
-    } else {
-        mp_obj_int_t *self = MP_OBJ_TO_PTR(self_in);
-        return mpz_as_float(&self->mpz);
-    }
+mp_float_t mp_obj_int_as_float_impl(mp_obj_t self_in) {
+    assert(MP_OBJ_IS_TYPE(self_in, &mp_type_int));
+    mp_obj_int_t *self = MP_OBJ_TO_PTR(self_in);
+    return mpz_as_float(&self->mpz);
 }
 #endif