summaryrefslogtreecommitdiff
path: root/range.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 /range.c
parent00d6bb5108209329996c8062ce3e947489c38ea7 (diff)
* 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 'range.c')
-rw-r--r--range.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/range.c b/range.c
index 3944951..388418b 100644
--- a/range.c
+++ b/range.c
@@ -595,7 +595,9 @@ range_bsearch(VALUE range)
smaller = cmp < 0; \
} \
else { \
- smaller = RTEST(v); \
+ rb_raise(rb_eTypeError, "wrong argument type %s" \
+ "(must respond be numeric, true, false or nil)", \
+ rb_obj_classname(v)); \
} \
} while (0)