diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-03 14:10:34 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-03 14:16:11 +0300 |
commit | 418aca976c33db443c2bfed69ff2a38e79320259 (patch) | |
tree | 27b574f105b0e5014b9d5fdf54d15afc7a4cc578 /py/objclosure.c | |
parent | 8f472ad5778876d3d8abcfec9459c0a106f629af (diff) | |
download | micropython-418aca976c33db443c2bfed69ff2a38e79320259.tar.gz micropython-418aca976c33db443c2bfed69ff2a38e79320259.zip |
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.
Diffstat (limited to 'py/objclosure.c')
-rw-r--r-- | py/objclosure.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objclosure.c b/py/objclosure.c index ca7c537f09..2b83cab71a 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, "<closure %p, n_closed=%u ", o, o->n_closed); + print(env, "<closure %s at %p, n_closed=%u ", mp_obj_fun_get_name(o->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, }; |