diff --git a/py/misc.h b/py/misc.h
index 989650c17a03c0509455b5b67b455c75dddf970e..278d59d4faa9f4d25137378a311ef37db5a8e294 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -60,8 +60,6 @@ bool unichar_isxdigit(unichar c);
 #define streq(s1, s2) (strcmp((s1), (s2)) == 0)
 */
 
-long strtonum(const char *restrict s, int base);
-
 /** variable string *********************************************/
 
 typedef struct _vstr_t {
diff --git a/py/objint.c b/py/objint.c
index 775e5644d05b52b38bd12451c5bd4c3e0afa7aa8..82bab9ea184ce396433f994913169fd7069c87b3 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -5,6 +5,7 @@
 
 #include "nlr.h"
 #include "misc.h"
+#include "strtonum.h"
 #include "mpconfig.h"
 #include "qstr.h"
 #include "obj.h"
@@ -24,7 +25,7 @@ STATIC mp_obj_t int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_
                 // a string, parse it
                 uint l;
                 const char *s = mp_obj_str_get_data(args[0], &l);
-                return MP_OBJ_NEW_SMALL_INT(strtonum(s, 0));
+                return MP_OBJ_NEW_SMALL_INT(mp_strtonum(s, 0));
             } else {
                 return MP_OBJ_NEW_SMALL_INT(mp_obj_get_int(args[0]));
             }
@@ -35,7 +36,7 @@ STATIC mp_obj_t int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_
             // TODO proper error checking of argument types
             uint l;
             const char *s = mp_obj_str_get_data(args[0], &l);
-            return MP_OBJ_NEW_SMALL_INT(strtonum(s, mp_obj_get_int(args[1])));
+            return MP_OBJ_NEW_SMALL_INT(mp_strtonum(s, mp_obj_get_int(args[1])));
         }
 
         default:
diff --git a/py/strtonum.c b/py/strtonum.c
index e83b9751dc9968330bc818b66a5aa8be7c4dbcbb..4a6275651274f7e96b39f88304018685e8451475 100644
--- a/py/strtonum.c
+++ b/py/strtonum.c
@@ -5,12 +5,13 @@
 #include <stdlib.h>
 
 #include "misc.h"
+#include "strtonum.h"
 #include "mpconfig.h"
 #include "qstr.h"
 #include "nlr.h"
 #include "obj.h"
 
-long strtonum(const char *restrict s, int base) {
+long mp_strtonum(const char *restrict s, int base) {
     int c, neg = 0;
     const char *p = s;
     char *num;
@@ -89,7 +90,7 @@ value_error:
 
 #else /* defined(UNIX) */
 
-long strtonum(const char *restrict s, int base) {
+long mp_strtonum(const char *restrict s, int base) {
     // TODO port strtol to stm
     return 0;
 }
diff --git a/py/strtonum.h b/py/strtonum.h
new file mode 100644
index 0000000000000000000000000000000000000000..10b6732edb2edc4c1e38549929678f659734fe53
--- /dev/null
+++ b/py/strtonum.h
@@ -0,0 +1 @@
+long mp_strtonum(const char *restrict s, int base);