py/objstr: Simplify printing of bytes objects when unicode enabled.

This commit is contained in:
Damien George 2015-09-03 23:03:57 +01:00
parent 516982242d
commit e2aa117798
1 changed files with 5 additions and 1 deletions

View File

@ -116,8 +116,12 @@ STATIC void str_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
return;
}
#endif
#if !MICROPY_PY_BUILTINS_STR_UNICODE
bool is_bytes = MP_OBJ_IS_TYPE(self_in, &mp_type_bytes);
if (kind == PRINT_STR && !is_bytes) {
#else
bool is_bytes = true;
#endif
if (!MICROPY_PY_BUILTINS_STR_UNICODE && kind == PRINT_STR && !is_bytes) {
mp_printf(print, "%.*s", str_len, str_data);
} else {
if (is_bytes) {