diff options
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/py/objfun.c b/py/objfun.c index 76adfef500..f00a90a089 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -296,7 +296,11 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, } #if MICROPY_PY_FUNCTION_ATTRS -STATIC void fun_bc_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { +STATIC void fun_bc_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { + if (dest[0] != MP_OBJ_NULL) { + // not load attribute + return; + } if (attr == MP_QSTR___name__) { dest[0] = MP_OBJ_NEW_QSTR(mp_obj_fun_get_name(self_in)); } @@ -311,7 +315,7 @@ const mp_obj_type_t mp_type_fun_bc = { #endif .call = fun_bc_call, #if MICROPY_PY_FUNCTION_ATTRS - .load_attr = fun_bc_load_attr, + .attr = fun_bc_attr, #endif }; |