aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-30 06:00:24 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-30 06:00:24 +0000
commit20c0fb69d65f20d42caf980de042396370dd0ba4 (patch)
tree6e4483a32181bc4e10dea1e42948ecdb920890c6 /array.c
parent00d6bb5108209329996c8062ce3e947489c38ea7 (diff)
downloadruby-20c0fb69d65f20d42caf980de042396370dd0ba4.tar.gz
* array.c (rb_ary_bsearch): Raise TypeError on bad return from block
* range.c (range_bsearch): ditto * test/ruby/test_array.rb (class): Test for above * test/ruby/test_range.rb (class): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/array.c b/array.c
index 3f448063ce..e76801df50 100644
--- a/array.c
+++ b/array.c
@@ -2462,7 +2462,9 @@ rb_ary_bsearch(VALUE ary)
}
}
else {
- smaller = RTEST(v);
+ rb_raise(rb_eTypeError, "wrong argument type %s"
+ "(must respond be numeric, true, false or nil)",
+ rb_obj_classname(v));
}
if (smaller) {
high = mid;