diff options
Diffstat (limited to 'py/objlist.c')
| -rw-r--r-- | py/objlist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/py/objlist.c b/py/objlist.c index 8c989facc..f431e273d 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -44,13 +44,18 @@ STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args); STATIC void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_list_t *o = MP_OBJ_TO_PTR(o_in); + const char *item_separator = ", "; if (!(MICROPY_PY_UJSON && kind == PRINT_JSON)) { kind = PRINT_REPR; + } else { + #if MICROPY_PY_UJSON_SEPARATORS + item_separator = MP_PRINT_GET_EXT(print)->item_separator; + #endif } mp_print_str(print, "["); for (size_t i = 0; i < o->len; i++) { if (i > 0) { - mp_print_str(print, ", "); + mp_print_str(print, item_separator); } mp_obj_print_helper(print, o->items[i], kind); } |
