From 418aca976c33db443c2bfed69ff2a38e79320259 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 3 May 2014 14:10:34 +0300 Subject: objclosure, objcell: Print detailed representation if was requested. Well, it is bound to "detailed error reporting", but that's closest what we have now without creating new entities. --- py/objcell.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'py/objcell.c') diff --git a/py/objcell.c b/py/objcell.c index 488a737971..35b44e996d 100644 --- a/py/objcell.c +++ b/py/objcell.c @@ -20,14 +20,13 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) { self->obj = obj; } -#if 0 +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_cell_t *o = o_in; - print(env, "obj); if (o->obj == MP_OBJ_NULL) { print(env, "(nil)"); } else { - //print(env, "%p", o->obj); mp_obj_print_helper(print, env, o->obj, PRINT_REPR); } print(env, ">"); @@ -36,8 +35,10 @@ STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env const mp_obj_type_t cell_type = { { &mp_type_type }, - .name = MP_QSTR_, // should never need to print cell type - //.print = cell_print, + .name = MP_QSTR_, // cell representation is just value in < > +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED + .print = cell_print, +#endif }; mp_obj_t mp_obj_new_cell(mp_obj_t obj) { -- cgit v1.2.3