[前][次][番号順一覧][スレッド一覧]

ruby-changes:38986

From: usa <ko1@a...>
Date: Tue, 30 Jun 2015 11:59:00 +0900 (JST)
Subject: [ruby-changes:38986] usa:r51067 (ruby_2_1): merge revision(s) 49224, 49225, 49234, 49235: [Backport #10711]

usa	2015-06-30 11:58:36 +0900 (Tue, 30 Jun 2015)

  New Revision: 51067

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51067

  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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/compar.c
    branches/ruby_2_1/numeric.c
    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 51066)
+++ ruby_2_1/ChangeLog	(revision 51067)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Tue Jun 30 11:56:24 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
+
 Mon Jun 29 13:22:14 2015  Shota Fukumori  <her@s...>
 
 	* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
Index: ruby_2_1/numeric.c
===================================================================
--- ruby_2_1/numeric.c	(revision 51066)
+++ ruby_2_1/numeric.c	(revision 51067)
@@ -3299,11 +3299,12 @@ static int https://github.com/ruby/ruby/blob/trunk/ruby_2_1/numeric.c#L3299
 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_1/compar.c
===================================================================
--- ruby_2_1/compar.c	(revision 51066)
+++ ruby_2_1/compar.c	(revision 51067)
@@ -20,7 +20,7 @@ rb_cmperr(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/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_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 51066)
+++ ruby_2_1/version.h	(revision 51067)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.7"
-#define RUBY_RELEASE_DATE "2015-06-29"
-#define RUBY_PATCHLEVEL 368
+#define RUBY_RELEASE_DATE "2015-06-30"
+#define RUBY_PATCHLEVEL 369
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 29
+#define RUBY_RELEASE_DAY 30
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/ruby/test_numeric.rb
===================================================================
--- ruby_2_1/test/ruby/test_numeric.rb	(revision 51066)
+++ ruby_2_1/test/ruby/test_numeric.rb	(revision 51067)
@@ -28,6 +28,10 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_numeric.rb#L28
       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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49224-49225,49234


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]