py: Fix passing of some wide int types to printf varg format list.

Passing an mp_uint_t to a %d printf format is incorrect for builds where
mp_uint_t is larger than word size (eg a nanboxing build).  This patch
adds some simple casting to int in these cases.
This commit is contained in:
Damien George
2016-03-14 22:40:39 +00:00
parent e7cd1699df
commit 2a1cca20b1
5 changed files with 7 additions and 7 deletions

View File

@@ -65,7 +65,7 @@ STATIC void closure_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_
mp_obj_closure_t *o = MP_OBJ_TO_PTR(o_in);
mp_print_str(print, "<closure ");
mp_obj_print_helper(print, o->fun, PRINT_REPR);
mp_printf(print, " at %p, n_closed=%u ", o, o->n_closed);
mp_printf(print, " at %p, n_closed=%u ", o, (int)o->n_closed);
for (mp_uint_t i = 0; i < o->n_closed; i++) {
if (o->closed[i] == MP_OBJ_NULL) {
mp_print_str(print, "(nil)");