From: ts Date: 2008-04-08T21:04:01+09:00 Subject: Re: Module.new(&block) in Ruby 1.9 Sylvain Joyeux wrote: > OK. Added as a follow-up to the bugreport, along with the implementation > of your suggestion. Well, in my private version I have. Surely the line number will be different for your version Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 15927) +++ vm_insnhelper.c (working copy) static VALUE @@ -1286,32 +1310,28 @@ else if (state == TAG_RETURN) { rb_control_frame_t *cfp = GET_CFP(); VALUE *dfp = GET_DFP(); - int is_orphan = 1; /** * check orphan: */ + pt = 0; while ((VALUE *) cfp < th->stack + th->stack_size) { - if (GET_DFP() == dfp) { - if (VM_FRAME_TYPE(cfp) == FRAME_MAGIC_LAMBDA) { - /* in lambda */ - is_orphan = 0; - break; - } + if (VM_FRAME_TYPE(cfp) == FRAME_MAGIC_LAMBDA && + cfp->dfp == dfp) { + pt = cfp->dfp; + break; } if (GET_LFP() == cfp->lfp && cfp->iseq->type == ISEQ_TYPE_METHOD) { - is_orphan = 0; + pt = GET_LFP(); break; } cfp++; } - if (is_orphan) { + if (!pt) { vm_localjump_error("unexpected return", throwobj, TAG_RETURN); } - - pt = GET_LFP(); } else { rb_bug("isns(throw): unsupport throw type"); Guy Decoux