diff options
Diffstat (limited to 'py/objclosure.c')
-rw-r--r-- | py/objclosure.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/py/objclosure.c b/py/objclosure.c index 09371b0348..2b83cab71a 100644 --- a/py/objclosure.c +++ b/py/objclosure.c @@ -1,8 +1,8 @@ #include <string.h> +#include "mpconfig.h" #include "nlr.h" #include "misc.h" -#include "mpconfig.h" #include "qstr.h" #include "obj.h" #include "objtuple.h" @@ -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, }; |