How do I check if an object is either a function or bound method?
Application is specifying an interrupt handler (which can be one of these two things). There is a macro to test for functions, but I could not find anything equivalent for methods.
bound method type check
Re: bound method type check
Code: Select all
if ((MP_OBJ_IS_FUN(args[ARG_func].u_obj)) || (MP_OBJ_IS_METH(args[ARG_func].u_obj))) {
}
Code: Select all
#define MP_OBJ_IS_METH(o) (MP_OBJ_IS_OBJ(o) && (((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_bound_method))