qstr mp_obj_fun_get_name(mp_const_obj_t fun_in) { const mp_obj_fun_bc_t *fun = fun_in; #if MICROPY_EMIT_NATIVE if (fun->base.type == &mp_type_fun_native) { // TODO native functions don't have name stored return MP_QSTR_; } #endif const byte *code_info = fun->bytecode; return mp_obj_code_get_name(code_info); }
qstr mp_obj_fun_get_name(mp_const_obj_t fun_in) { const mp_obj_fun_bc_t *fun = MP_OBJ_TO_PTR(fun_in); #if MICROPY_EMIT_NATIVE if (fun->base.type == &mp_type_fun_native) { // TODO native functions don't have name stored return MP_QSTR_; } #endif const byte *bc = fun->bytecode; mp_decode_uint(&bc); // skip n_state mp_decode_uint(&bc); // skip n_exc_stack bc++; // skip scope_params bc++; // skip n_pos_args bc++; // skip n_kwonly_args bc++; // skip n_def_pos_args return mp_obj_code_get_name(bc); }
const char *mp_obj_fun_get_name(mp_const_obj_t fun_in) { const mp_obj_fun_bc_t *fun = fun_in; const byte *code_info = fun->bytecode; return mp_obj_code_get_name(code_info); }
void gen_instance_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { mp_obj_gen_instance_t *self = self_in; print(env, "<generator object '%s' at %p>", mp_obj_code_get_name(self->code_info), self_in); }