ruby-changes:42213
From: usa <ko1@a...>
Date: Fri, 25 Mar 2016 22:56:42 +0900 (JST)
Subject: [ruby-changes:42213] usa:r54287 (ruby_2_1): revert r54276 because of incompatibility.
usa 2016-03-25 22:56:36 +0900 (Fri, 25 Mar 2016) New Revision: 54287 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54287 Log: revert r54276 because of incompatibility. Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/numeric.c branches/ruby_2_1/test/ruby/test_float.rb branches/ruby_2_1/test/ruby/test_numeric.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 54286) +++ ruby_2_1/ChangeLog (revision 54287) @@ -48,12 +48,6 @@ Fri Mar 25 18:30:55 2016 Anthony Dmitri https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L48 * 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@r...> - - * 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@g...> * parse.y (parse_numvar): NTH_REF must be less than a half of Index: ruby_2_1/test/ruby/test_numeric.rb =================================================================== --- ruby_2_1/test/ruby/test_numeric.rb (revision 54286) +++ ruby_2_1/test/ruby/test_numeric.rb (revision 54287) @@ -247,8 +247,8 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_numeric.rb#L247 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) } Index: ruby_2_1/test/ruby/test_float.rb =================================================================== --- ruby_2_1/test/ruby/test_float.rb (revision 54286) +++ ruby_2_1/test/ruby/test_float.rb (revision 54287) @@ -558,7 +558,7 @@ class TestFloat < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_float.rb#L558 end def test_num2dbl - assert_raise(TypeError) do + assert_raise(ArgumentError) do 1.0.step(2.0, "0.5") {} end assert_raise(TypeError) do Index: ruby_2_1/numeric.c =================================================================== --- ruby_2_1/numeric.c (revision 54286) +++ ruby_2_1/numeric.c (revision 54287) @@ -253,12 +253,6 @@ coerce_rescue(VALUE *x) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/numeric.c#L253 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, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/numeric.c#L1864 } } -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 https://github.com/ruby/ruby/blob/trunk/ruby_2_1/numeric.c#L1898 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); } Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 54286) +++ ruby_2_1/version.h (revision 54287) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #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 Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Reverse-merged /trunk:r53949 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/