diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index f74f2673ddd57439ad936da04697d476a7edaa3d..0d9564a48b01806ca0bf681ad0095c0fe3654dd6 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -285,7 +285,7 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
     mp_uint_t optlen;
     mp_int_t val;
     if (mp_obj_is_integer(args[3])) {
-        val = mp_obj_int_get_truncated(args[3]);
+        val = mp_obj_get_int_truncated(args[3]);
         optval = &val;
         optlen = sizeof(val);
     } else {
diff --git a/extmod/modure.c b/extmod/modure.c
index 9bc72add21310210d35fe8bbdc9d9db2914468e9..f54b060c8f4dc98d205ec0994d8f0935f9452aaf 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -59,7 +59,7 @@ STATIC void match_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind
 
 STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) {
     mp_obj_match_t *self = self_in;
-    mp_int_t no = mp_obj_int_get_truncated(no_in);
+    mp_int_t no = mp_obj_get_int(no_in);
     if (no < 0 || no >= self->num_matches) {
         nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, no_in));
     }
@@ -135,7 +135,7 @@ STATIC mp_obj_t re_split(uint n_args, const mp_obj_t *args) {
 
     int maxsplit = 0;
     if (n_args > 2) {
-        maxsplit = mp_obj_int_get_truncated(args[2]);
+        maxsplit = mp_obj_get_int(args[2]);
     }
 
     mp_obj_t retval = mp_obj_new_list(0, NULL);
diff --git a/py/obj.c b/py/obj.c
index 2b5585be422023bb2d80774243c725906ae7236d..555a4a8b96aea45df3fdb2a7ac0950067d43bd9e 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -231,6 +231,14 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) {
     }
 }
 
+mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg) {
+    if (MP_OBJ_IS_INT(arg)) {
+        return mp_obj_int_get_truncated(arg);
+    } else {
+        return mp_obj_get_int(arg);
+    }
+}
+
 // returns false if arg is not of integral type
 // returns true and sets *value if it is of integral type
 // can throw OverflowError if arg is of integral type, but doesn't fit in a mp_int_t
diff --git a/py/obj.h b/py/obj.h
index b9e912a33aadbdd97ab9dbc48c25de7e0b099aad..5c4ba372a24dbc2f9c5f72704ea6fc2971dc38ac 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -511,6 +511,7 @@ bool mp_obj_is_callable(mp_obj_t o_in);
 bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2);
 
 mp_int_t mp_obj_get_int(mp_const_obj_t arg);
+mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg);
 bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
 #if MICROPY_PY_BUILTINS_FLOAT
 mp_float_t mp_obj_get_float(mp_obj_t self_in);
diff --git a/py/objtype.c b/py/objtype.c
index 7b293c959865037a5497c26e435b72939384b44d..f593271fb506b2ed17f9c4de4887d67d1cd17a20 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -359,7 +359,7 @@ STATIC mp_obj_t instance_unary_op(mp_uint_t op, mp_obj_t self_in) {
         mp_obj_t val = mp_call_function_1(member[0], self_in);
         // __hash__ must return a small int
         if (op == MP_UNARY_OP_HASH) {
-            val = MP_OBJ_NEW_SMALL_INT(mp_obj_int_get_truncated(val));
+            val = MP_OBJ_NEW_SMALL_INT(mp_obj_get_int_truncated(val));
         }
         return val;
     } else {
diff --git a/py/stream.c b/py/stream.c
index 640659ec5ad626ddad72a8195a6597e1b62dbb07..258f916e088aa12e5784e7fb9c6ec4a93efb5c74 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -225,7 +225,7 @@ STATIC mp_obj_t stream_readinto(mp_uint_t n_args, const mp_obj_t *args) {
     // https://docs.python.org/3/library/socket.html#socket.socket.recv_into
     mp_uint_t len = bufinfo.len;
     if (n_args > 2) {
-        len = mp_obj_int_get_truncated(args[2]);
+        len = mp_obj_get_int(args[2]);
         if (len > bufinfo.len) {
             len = bufinfo.len;
         }
diff --git a/stmhal/modusocket.c b/stmhal/modusocket.c
index 4ef614e4ca53430b557c77cdb4f14a074ea0ca89..402378a38d8691cc922706653dfffce87054c23d 100644
--- a/stmhal/modusocket.c
+++ b/stmhal/modusocket.c
@@ -287,7 +287,7 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
     mp_uint_t optlen;
     mp_int_t val;
     if (mp_obj_is_integer(args[3])) {
-        val = mp_obj_int_get_truncated(args[3]);
+        val = mp_obj_get_int_truncated(args[3]);
         optval = &val;
         optlen = sizeof(val);
     } else {