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/objclosure.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'py/objclosure.c') diff --git a/py/objclosure.c b/py/objclosure.c index ca7c537f0..2b83cab71 100644 --- a/py/objclosure.c +++ b/py/objclosure.c @@ -38,10 +38,10 @@ mp_obj_t closure_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t * } } -#if 0 +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED STATIC void closure_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_closure_t *o = o_in; - print(env, "n_closed); + print(env, "fun), o, o->n_closed); for (int i = 0; i < o->n_closed; i++) { if (o->closed[i] == MP_OBJ_NULL) { print(env, "(nil)"); @@ -57,7 +57,9 @@ STATIC void closure_print(void (*print)(void *env, const char *fmt, ...), void * const mp_obj_type_t closure_type = { { &mp_type_type }, .name = MP_QSTR_closure, - //.print = closure_print, +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED + .print = closure_print, +#endif .call = closure_call, }; -- cgit v1.2.3