summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--range.c2
-rw-r--r--test/ruby/test_range.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/range.c b/range.c
index db8e9ee..ff40b52 100644
--- a/range.c
+++ b/range.c
@@ -796,7 +796,7 @@ range_each(VALUE range)
args[0] = end;
args[1] = EXCL(range) ? Qtrue : Qfalse;
- rb_block_call(tmp, rb_intern("upto"), 2, args, rb_yield_block, 0);
+ rb_block_call(tmp, rb_intern("upto"), 2, args, each_i, 0);
}
else {
if (!discrete_object_p(beg)) {
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 914baf9..12c0c59 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -558,4 +558,12 @@ class TestRange < Test::Unit::TestCase
assert_equal(42, answer, msg)
}
end
+
+ def test_each_no_blockarg
+ a = "a"
+ def a.upto(x, e, &b)
+ super {|y| b.call(y) {|z| assert(false)}}
+ end
+ (a.."c").each {|x, &b| assert_nil(b)}
+ end
end