Project

General

Profile

Bug #12531 » fix_curry_with_block.patch

a patch for segmentation fault - eccyan (Daisuke Sato), 06/28/2016 09:56 PM

View differences:

proc.c
return arity;
}
else {
return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), passed_proc);
VALUE corrected_passed_proc = (SYMBOL_P(passed_proc)) ? sym_proc_new(rb_cProc, passed_proc) : passed_proc;
return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), corrected_passed_proc);
}
}
test/ruby/test_proc.rb
assert_equal(9, b)
end
def test_curry_with_block
b = proc { true }.curry
assert(b.call, "without block")
assert(b.call { |o| o.to_s }, "with block")
assert(b.call(&:to_s), "with sym block")
b = lambda { true }.curry
assert(b.call, "without block")
assert(b.call { |o| o.to_s }, "with block")
assert(b.call(&:to_s), "with sym block")
end
def test_lambda?
l = proc {}
assert_equal(false, l.lambda?)
(2-2/2)