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

@@ -788,7 +788,7 @@ too_short:
"wrong number of values to unpack"));
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
"need more than %d values to unpack", seq_len));
"need more than %d values to unpack", (int)seq_len));
}
too_long:
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
@@ -796,7 +796,7 @@ too_long:
"wrong number of values to unpack"));
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
"too many values to unpack (expected %d)", num));
"too many values to unpack (expected %d)", (int)num));
}
}
@@ -863,7 +863,7 @@ too_short:
"wrong number of values to unpack"));
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
"need more than %d values to unpack", seq_len));
"need more than %d values to unpack", (int)seq_len));
}
}