diff --git a/py/obj.c b/py/obj.c
index 4534ef1b2862db11bd598026f01cefcccb7979bd..65a35c86fddfd56bbbf566bf147b7c9cde1b388c 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -351,7 +351,7 @@ void mp_obj_get_array_fixed_n(mp_obj_t o, mp_uint_t len, mp_obj_t **items) {
 }
 
 // is_slice determines whether the index is a slice index
-mp_uint_t mp_get_index(const mp_obj_type_t *type, mp_uint_t len, mp_obj_t index, bool is_slice) {
+size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool is_slice) {
     mp_int_t i;
     if (MP_OBJ_IS_SMALL_INT(index)) {
         i = MP_OBJ_SMALL_INT_VALUE(index);
@@ -384,7 +384,9 @@ mp_uint_t mp_get_index(const mp_obj_type_t *type, mp_uint_t len, mp_obj_t index,
             }
         }
     }
-    return i;
+
+    // By this point 0 <= i <= len and so fits in a size_t
+    return (size_t)i;
 }
 
 mp_obj_t mp_obj_id(mp_obj_t o_in) {
diff --git a/py/obj.h b/py/obj.h
index 79a6d56fad01d334859459911dc7111160bf4a05..03dadeb07e5197c485708c3525bdc2618fea703f 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -674,7 +674,7 @@ void mp_obj_get_complex(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
 //qstr mp_obj_get_qstr(mp_obj_t arg);
 void mp_obj_get_array(mp_obj_t o, mp_uint_t *len, mp_obj_t **items); // *items may point inside a GC block
 void mp_obj_get_array_fixed_n(mp_obj_t o, mp_uint_t len, mp_obj_t **items); // *items may point inside a GC block
-mp_uint_t mp_get_index(const mp_obj_type_t *type, mp_uint_t len, mp_obj_t index, bool is_slice);
+size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool is_slice);
 mp_obj_t mp_obj_id(mp_obj_t o_in);
 mp_obj_t mp_obj_len(mp_obj_t o_in);
 mp_obj_t mp_obj_len_maybe(mp_obj_t o_in); // may return MP_OBJ_NULL
diff --git a/py/objarray.c b/py/objarray.c
index a84a631519ebdb683d07e824d24ece52756c6838..af75af91758f63bfe33323a763ba63ce4c682525 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -471,7 +471,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
             return MP_OBJ_FROM_PTR(res);
 #endif
         } else {
-            mp_uint_t index = mp_get_index(o->base.type, o->len, index_in, false);
+            size_t index = mp_get_index(o->base.type, o->len, index_in, false);
             #if MICROPY_PY_BUILTINS_MEMORYVIEW
             if (o->base.type == &mp_type_memoryview) {
                 index += o->free;
diff --git a/py/objlist.c b/py/objlist.c
index ba7898415db854c0dfdf9a3f5d8d8d382fde01a6..312cef6d3e0b7ceae698f4cc3926da67ff33cf07 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -186,7 +186,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
             return MP_OBJ_FROM_PTR(res);
         }
 #endif
-        mp_uint_t index_val = mp_get_index(self->base.type, self->len, index, false);
+        size_t index_val = mp_get_index(self->base.type, self->len, index, false);
         return self->items[index_val];
     } else {
 #if MICROPY_PY_BUILTINS_SLICE
@@ -268,7 +268,7 @@ STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
     if (self->len == 0) {
         mp_raise_msg(&mp_type_IndexError, "pop from empty list");
     }
-    mp_uint_t index = mp_get_index(self->base.type, self->len, n_args == 1 ? MP_OBJ_NEW_SMALL_INT(-1) : args[1], false);
+    size_t index = mp_get_index(self->base.type, self->len, n_args == 1 ? MP_OBJ_NEW_SMALL_INT(-1) : args[1], false);
     mp_obj_t ret = self->items[index];
     self->len -= 1;
     memmove(self->items + index, self->items + index + 1, (self->len - index) * sizeof(mp_obj_t));
@@ -490,7 +490,7 @@ void mp_obj_list_set_len(mp_obj_t self_in, size_t len) {
 
 void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
     mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
-    mp_uint_t i = mp_get_index(self->base.type, self->len, index, false);
+    size_t i = mp_get_index(self->base.type, self->len, index, false);
     self->items[i] = value;
 }
 
diff --git a/py/objrange.c b/py/objrange.c
index dd074a98ad6e78057b61121aeb28260088c78517..5bf0bc7a9730b04506fa3cab4473aa836498ab55 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -155,7 +155,7 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
             return MP_OBJ_FROM_PTR(o);
         }
 #endif
-        uint index_val = mp_get_index(self->base.type, len, index, false);
+        size_t index_val = mp_get_index(self->base.type, len, index, false);
         return MP_OBJ_NEW_SMALL_INT(self->start + index_val * self->step);
     } else {
         return MP_OBJ_NULL; // op not supported
diff --git a/py/objstr.c b/py/objstr.c
index 1e71617bdab00e96622d04798294e079e0eb8bfd..4053efb889dcdd4b39011283b10de3bb73df7558 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -388,7 +388,7 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
 // objstrunicode defines own version
 const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, size_t self_len,
                              mp_obj_t index, bool is_slice) {
-    mp_uint_t index_val = mp_get_index(type, self_len, index, is_slice);
+    size_t index_val = mp_get_index(type, self_len, index, is_slice);
     return self_data + index_val;
 }
 #endif
@@ -408,7 +408,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
             return mp_obj_new_str_of_type(type, self_data + slice.start, slice.stop - slice.start);
         }
 #endif
-        mp_uint_t index_val = mp_get_index(type, self_len, index, false);
+        size_t index_val = mp_get_index(type, self_len, index, false);
         // If we have unicode enabled the type will always be bytes, so take the short cut.
         if (MICROPY_PY_BUILTINS_STR_UNICODE || type == &mp_type_bytes) {
             return MP_OBJ_NEW_SMALL_INT(self_data[index_val]);
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index 441ec293d9601c966de28132001802d1bcecd066..9a6ce9b9a249df2e32c589ab9fa8b1f307bdfc84 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -120,7 +120,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
     // so it must handle bytes.
     if (type == &mp_type_bytes) {
         // Taken from objstr.c:str_index_to_ptr()
-        mp_uint_t index_val = mp_get_index(type, self_len, index, is_slice);
+        size_t index_val = mp_get_index(type, self_len, index, is_slice);
         return self_data + index_val;
     }
 
diff --git a/py/objtuple.c b/py/objtuple.c
index b28807c0d08008916a4f7c5df4a3f4346a2408fc..a8efdc7f92f00e7c002ae1eac087798020a4d10c 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -186,7 +186,7 @@ mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
             return MP_OBJ_FROM_PTR(res);
         }
 #endif
-        mp_uint_t index_value = mp_get_index(self->base.type, self->len, index, false);
+        size_t index_value = mp_get_index(self->base.type, self->len, index, false);
         return self->items[index_value];
     } else {
         return MP_OBJ_NULL; // op not supported
diff --git a/py/sequence.c b/py/sequence.c
index bc2cfc077c583cde791775b76c2adc0e7bf90451..9aa3b6a896c581b625416127559bc8a088c19cfd 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -239,8 +239,8 @@ bool mp_seq_cmp_objs(mp_uint_t op, const mp_obj_t *items1, mp_uint_t len1, const
 mp_obj_t mp_seq_index_obj(const mp_obj_t *items, mp_uint_t len, mp_uint_t n_args, const mp_obj_t *args) {
     mp_obj_type_t *type = mp_obj_get_type(args[0]);
     mp_obj_t value = args[1];
-    uint start = 0;
-    uint stop = len;
+    size_t start = 0;
+    size_t stop = len;
 
     if (n_args >= 3) {
         start = mp_get_index(type, len, args[2], true);
@@ -249,7 +249,7 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, mp_uint_t len, mp_uint_t n_args
         }
     }
 
-    for (mp_uint_t i = start; i < stop; i++) {
+    for (size_t i = start; i < stop; i++) {
         if (mp_obj_equal(items[i], value)) {
             // Common sense says this cannot overflow small int
             return MP_OBJ_NEW_SMALL_INT(i);