summaryrefslogtreecommitdiff
path: root/py/modbuiltins.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r--py/modbuiltins.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index c8e3235f6..e6f82df6f 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -137,7 +137,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_callable_obj, mp_builtin_callable);
STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
#if MICROPY_PY_BUILTINS_STR_UNICODE
mp_uint_t c = mp_obj_get_int(o_in);
- char str[4];
+ uint8_t str[4];
int len = 0;
if (c < 0x80) {
*str = c; len = 1;
@@ -159,12 +159,12 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
} else {
mp_raise_ValueError("chr() arg not in range(0x110000)");
}
- return mp_obj_new_str_via_qstr(str, len);
+ return mp_obj_new_str_via_qstr((char*)str, len);
#else
mp_int_t ord = mp_obj_get_int(o_in);
if (0 <= ord && ord <= 0xff) {
- char str[1] = {ord};
- return mp_obj_new_str_via_qstr(str, 1);
+ uint8_t str[1] = {ord};
+ return mp_obj_new_str_via_qstr((char*)str, 1);
} else {
mp_raise_ValueError("chr() arg not in range(256)");
}