ruby-changes:37362
From: usa <ko1@a...>
Date: Fri, 30 Jan 2015 15:54:49 +0900 (JST)
Subject: [ruby-changes:37362] usa:r49443 (ruby_2_0_0): merge revision(s) 49224, 49225, 49234, 49235: [Backport #10711]
usa 2015-01-30 15:54:29 +0900 (Fri, 30 Jan 2015) New Revision: 49443 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49443 Log: merge revision(s) 49224,49225,49234,49235: [Backport #10711] * numeric.c (bit_coerce): use original value for error message [ruby-core:67405] [Bug #10711] * test/ruby/test_numeric.rb (test_coerce): check error message Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/compar.c branches/ruby_2_0_0/numeric.c branches/ruby_2_0_0/test/ruby/test_numeric.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 49442) +++ ruby_2_0_0/ChangeLog (revision 49443) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Jan 30 15:47:49 2015 Eric Wong <e@8...> + + * numeric.c (bit_coerce): use original value for error message + [ruby-core:67405] [Bug #10711] + * test/ruby/test_numeric.rb (test_coerce): check error message + Tue Jan 27 17:05:43 2015 Seiei Higa <hanachin@g...> * vm_method.c (rb_alias): raise a NameError when creating alias to Index: ruby_2_0_0/numeric.c =================================================================== --- ruby_2_0_0/numeric.c (revision 49442) +++ ruby_2_0_0/numeric.c (revision 49443) @@ -3210,11 +3210,12 @@ static int https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/numeric.c#L3210 bit_coerce(VALUE *x, VALUE *y, int err) { if (!FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) { + VALUE orig = *x; do_coerce(x, y, err); if (!FIXNUM_P(*x) && !RB_TYPE_P(*x, T_BIGNUM) && !FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) { if (!err) return FALSE; - coerce_failed(*x, *y); + coerce_failed(orig, *y); } } return TRUE; Index: ruby_2_0_0/compar.c =================================================================== --- ruby_2_0_0/compar.c (revision 49442) +++ ruby_2_0_0/compar.c (revision 49443) @@ -20,7 +20,7 @@ rb_cmperr(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compar.c#L20 { const char *classname; - if (SPECIAL_CONST_P(y)) { + if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) { y = rb_inspect(y); classname = StringValuePtr(y); } Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 49442) +++ ruby_2_0_0/version.h (revision 49443) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2015-01-28" -#define RUBY_PATCHLEVEL 623 +#define RUBY_RELEASE_DATE "2015-01-30" +#define RUBY_PATCHLEVEL 624 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_DAY 30 #include "ruby/version.h" Index: ruby_2_0_0/test/ruby/test_numeric.rb =================================================================== --- ruby_2_0_0/test/ruby/test_numeric.rb (revision 49442) +++ ruby_2_0_0/test/ruby/test_numeric.rb (revision 49443) @@ -5,8 +5,8 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_numeric.rb#L5 class DummyNumeric < Numeric end - def assert_raise_with_message(exc, pattern, &blk) - e = assert_raise(exc, &blk) + def assert_raise_with_message(exc, pattern, msg = nil, &blk) + e = assert_raise(exc, msg, &blk) assert_match(pattern, e.message) end @@ -38,6 +38,10 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_numeric.rb#L38 assert_raise_with_message(TypeError, /:"\\u3042"/) {1|:"\u{3042}"} assert_raise_with_message(TypeError, /:"\\u3042"/) {1^:"\u{3042}"} end + + bug10711 = '[ruby-core:67405] [Bug #10711]' + exp = "1.2 can't be coerced into Fixnum" + assert_raise_with_message(TypeError, exp, bug10711) { 1 & 1.2 } end def test_dummynumeric Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49224-49225,49234 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/