Exception when converting block arg


#1

e$B1sF#$H?=$7$^$9!#e(B

1.9 e$B$G%V%m%C%/0z?t$Ke(B proc
e$B0J30$NCM$rM?$($?$H$-$NNc30$,!"CM$K$h$i$:e(B
wrong argument type NilClass (expected Proc) e$B$K$J$j$^$9!#e(B

$ ./ruby -e ‘foo(&1)’
-e:1:in `’: wrong argument type NilClass (expected Proc)
(TypeError)

e$B$3$N>l9g$Oe(B wrong argument type Fixnum (expected Proc)
e$B$K$J$C$FM_$7$$$He(B
e$B;W$$$^$9!#e(B1.8 e$B$Ne(B eval.c
e$B$G$O0J2<$N$h$&$KBP:v:Q$_$G$7$?!#e(B

Index: insnhelper.ci

— insnhelper.ci (revision 12674)
+++ insnhelper.ci (working copy)
@@ -198,18 +198,19 @@
if (block) {
if (flag & VM_CALL_ARGS_BLOCKARG_BIT) {
rb_proc_t *po;

  •  VALUE proc;
    
  •  VALUE proc, b;
    
     proc = *(--cfp->sp);
    
     if (proc != Qnil) {
    
    if (!rb_obj_is_proc(proc)) {
  •    proc = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
    
  •    if (!rb_obj_is_proc(proc)) {
    
  •    b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
    
  •    if (!rb_obj_is_proc(b)) {
     rb_raise(rb_eTypeError,
        "wrong argument type %s (expected Proc)",
        rb_obj_classname(proc));
       }
    
  •    proc = b;
    
    }
    GetProcPtr(proc, po);
    blockptr = &po->block;

#2

e$B!!$5$5$@$G$9!#e(B

Yusuke ENDOH wrote:

1.9 e$B$G%V%m%C%/0z?t$Ke(B proc e$B0J30$NCM$rM?$($?$H$-$NNc30$,!"CM$K$h$i$:e(B
wrong argument type NilClass (expected Proc) e$B$K$J$j$^$9!#e(B

e$B!!$"$j$,$H$&$4$6$$$^$9!#BP1~$7$^$7$?!#e(B