diff --git bootstraptest/test_block.rb bootstraptest/test_block.rb index cdc5960..4347fdd 100644 --- bootstraptest/test_block.rb +++ bootstraptest/test_block.rb @@ -611,3 +611,17 @@ assert_equal 'ok', %q{ end 'ok' } + +assert_equal 'ok', %q{ + class NilClass + def to_proc + Proc.new {|x| x } + end + end + + def foo(&blk) + blk.call('ok') + end + + foo(&nil) +}, '[ruby-core:68384] [Bug #10929]' diff --git vm_args.c vm_args.c index cf7256b..e1cb8ac 100644 --- vm_args.c +++ vm_args.c @@ -755,7 +755,7 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp, rb proc = *(--reg_cfp->sp); - if (proc != Qnil) { + if (proc != Qnil || rb_respond_to(Qnil, idTo_proc)) { if (!rb_obj_is_proc(proc)) { VALUE b;