aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 11:42:31 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 11:42:31 +0000
commitef968551c8a52f33939d46db20557320f4a2ecc9 (patch)
tree5be6f667920e6dd7bca9130204f52946a376d4e6 /numeric.c
parentd2062d6e110a5c97850820bcba12fd3aff041806 (diff)
downloadruby-ef968551c8a52f33939d46db20557320f4a2ecc9.tar.gz
no longer rescue exceptions of #coerce in Integer#step
* numeric.c (num_step_negative_p): no more error hiding. * test/ruby/test_float.rb, test/ruby/test_numeric.rb: follow the change. [Feature #7688] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/numeric.c b/numeric.c
index dda44c0a77..713a3e482e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -446,12 +446,6 @@ coerce_failed(VALUE x, VALUE y)
y, rb_obj_class(x));
}
-static VALUE
-coerce_rescue_quiet(VALUE arg, VALUE errinfo)
-{
- return Qundef;
-}
-
static int
do_coerce(VALUE *x, VALUE *y, int err)
{
@@ -2585,17 +2579,11 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
}
}
-static VALUE
-num_step_compare_with_zero(VALUE num)
-{
- VALUE zero = INT2FIX(0);
- return rb_check_funcall(num, '>', 1, &zero);
-}
-
static int
num_step_negative_p(VALUE num)
{
const ID mid = '<';
+ VALUE zero = INT2FIX(0);
VALUE r;
if (FIXNUM_P(num)) {
@@ -2606,7 +2594,8 @@ num_step_negative_p(VALUE num)
if (method_basic_p(rb_cInteger))
return BIGNUM_NEGATIVE_P(num);
}
- r = rb_rescue(num_step_compare_with_zero, num, coerce_rescue_quiet, Qnil);
+
+ r = rb_check_funcall(num, '>', 1, &zero);
if (r == Qundef) {
coerce_failed(num, INT2FIX(0));
}