summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--numeric.c36
-rw-r--r--test/ruby/test_float.rb2
-rw-r--r--test/ruby/test_numeric.rb4
-rw-r--r--version.h2
5 files changed, 5 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 3febc5723d..08fa3c5a08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,12 +48,6 @@ Fri Mar 25 18:30:55 2016 Anthony Dmitriyev <antstorm@gmail.com>
* net/ftp.rb: add NullSocket#closed? to fix closing not opened
connection. [Fix GH-1232]
-Fri Mar 25 18:26:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (num_step_scan_args): comparison String with Numeric
- should raise TypeError. it is an invalid type, but not a
- mismatch the number of arguments. [ruby-core:62430] [Bug #9810]
-
Fri Mar 25 18:24:04 2016 Victor Nawothnig <Victor.Nawothnig@gmail.com>
* parse.y (parse_numvar): NTH_REF must be less than a half of
diff --git a/numeric.c b/numeric.c
index f9b22302ae..ba2fb49b3b 100644
--- a/numeric.c
+++ b/numeric.c
@@ -253,12 +253,6 @@ coerce_rescue(VALUE *x)
return Qnil; /* dummy */
}
-static VALUE
-coerce_rescue_quiet(VALUE arg, VALUE errinfo)
-{
- return Qundef;
-}
-
static int
do_coerce(VALUE *x, VALUE *y, int err)
{
@@ -1870,34 +1864,6 @@ 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 r;
-
- if (FIXNUM_P(num)) {
- if (method_basic_p(rb_cFixnum))
- return (SIGNED_VALUE)num < 0;
- }
- else if (RB_TYPE_P(num, T_BIGNUM)) {
- if (method_basic_p(rb_cBignum))
- return RBIGNUM_NEGATIVE_P(num);
- }
- r = rb_rescue(num_step_compare_with_zero, num, coerce_rescue_quiet, Qnil);
- if (r == Qundef) {
- coerce_failed(num, INT2FIX(0));
- }
- return !RTEST(r);
-}
-
static int
num_step_scan_args(int argc, const VALUE *argv, VALUE *to, VALUE *step)
{
@@ -1932,7 +1898,7 @@ num_step_scan_args(int argc, const VALUE *argv, VALUE *to, VALUE *step)
if (NIL_P(*step)) {
*step = INT2FIX(1);
}
- desc = num_step_negative_p(*step);
+ desc = !positive_int_p(*step);
if (NIL_P(*to)) {
*to = desc ? DBL2NUM(-INFINITY) : DBL2NUM(INFINITY);
}
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index ca171b5c27..a959f60a69 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -558,7 +558,7 @@ class TestFloat < Test::Unit::TestCase
end
def test_num2dbl
- assert_raise(TypeError) do
+ assert_raise(ArgumentError) do
1.0.step(2.0, "0.5") {}
end
assert_raise(TypeError) do
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 79e152955e..98fabc4e13 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -247,8 +247,8 @@ class TestNumeric < Test::Unit::TestCase
assert_raise(ArgumentError) { 1.step(10, 1, 0).size }
assert_raise(ArgumentError) { 1.step(10, 0) { } }
assert_raise(ArgumentError) { 1.step(10, 0).size }
- assert_raise(TypeError) { 1.step(10, "1") { } }
- assert_raise(TypeError) { 1.step(10, "1").size }
+ assert_raise(ArgumentError) { 1.step(10, "1") { } }
+ assert_raise(ArgumentError) { 1.step(10, "1").size }
assert_raise(TypeError) { 1.step(10, nil) { } }
assert_raise(TypeError) { 1.step(10, nil).size }
assert_nothing_raised { 1.step(by: 0, to: nil) }
diff --git a/version.h b/version.h
index 1d2827894e..524f466cad 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.9"
#define RUBY_RELEASE_DATE "2016-03-25"
-#define RUBY_PATCHLEVEL 484
+#define RUBY_PATCHLEVEL 485
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3