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

ruby-changes:47707

From: nagachika <ko1@a...>
Date: Sun, 10 Sep 2017 21:33:15 +0900 (JST)
Subject: [ruby-changes:47707] nagachika:r59823 (ruby_2_4): merge revision(s) 59765: [Backport #13877]

nagachika	2017-09-10 21:33:09 +0900 (Sun, 10 Sep 2017)

  New Revision: 59823

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

  Log:
    merge revision(s) 59765: [Backport #13877]
    
    ruby.h: unnormalized Fixnum value
    
    * include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
      on mingw/mswin.  [ruby-core:82687] [Bug #13877]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/ext/bigdecimal/bigdecimal.c
    branches/ruby_2_4/ext/date/date_core.c
    branches/ruby_2_4/ext/openssl/ossl_bn.c
    branches/ruby_2_4/include/ruby/ruby.h
    branches/ruby_2_4/internal.h
    branches/ruby_2_4/test/bigdecimal/test_bigdecimal.rb
    branches/ruby_2_4/test/date/test_date.rb
    branches/ruby_2_4/version.h
Index: ruby_2_4/test/date/test_date.rb
===================================================================
--- ruby_2_4/test/date/test_date.rb	(revision 59822)
+++ ruby_2_4/test/date/test_date.rb	(revision 59823)
@@ -129,6 +129,8 @@ class TestDate < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/date/test_date.rb#L129
     assert_equal(3, h.size)
     assert_equal(9, h[Date.new(1999,5,25)])
     assert_equal(9, h[DateTime.new(1999,5,25)])
+
+    assert_instance_of(String, Date.new(1999,5,25).hash.to_s)
   end
 
   def test_freeze
Index: ruby_2_4/test/bigdecimal/test_bigdecimal.rb
===================================================================
--- ruby_2_4/test/bigdecimal/test_bigdecimal.rb	(revision 59822)
+++ ruby_2_4/test/bigdecimal/test_bigdecimal.rb	(revision 59823)
@@ -549,6 +549,7 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/bigdecimal/test_bigdecimal.rb#L549
     a.each_with_index do |x, i|
       assert_equal(i, h[x])
     end
+    assert_instance_of(String, b.hash.to_s)
   end
 
   def test_marshal
Index: ruby_2_4/include/ruby/ruby.h
===================================================================
--- ruby_2_4/include/ruby/ruby.h	(revision 59822)
+++ ruby_2_4/include/ruby/ruby.h	(revision 59823)
@@ -1575,6 +1575,9 @@ rb_num2char_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/include/ruby/ruby.h#L1575
 #define NUM2CHR(x) RB_NUM2CHR(x)
 #define CHR2FIX(x) RB_CHR2FIX(x)
 
+#define RB_ST2FIX(h) RB_LONG2FIX((long)(h))
+#define ST2FIX(h) RB_ST2FIX(h)
+
 #define RB_ALLOC_N(type,n) ((type*)ruby_xmalloc2((size_t)(n),sizeof(type)))
 #define RB_ALLOC(type) ((type*)ruby_xmalloc(sizeof(type)))
 #define RB_ZALLOC_N(type,n) ((type*)ruby_xcalloc((size_t)(n),sizeof(type)))
Index: ruby_2_4/ext/date/date_core.c
===================================================================
--- ruby_2_4/ext/date/date_core.c	(revision 59822)
+++ ruby_2_4/ext/date/date_core.c	(revision 59823)
@@ -6444,7 +6444,7 @@ d_lite_hash(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/ext/date/date_core.c#L6444
     h[2] = m_df(dat);
     h[3] = m_sf(dat);
     v = rb_memhash(h, sizeof(h));
-    return LONG2FIX(v);
+    return ST2FIX(v);
 }
 
 #include "date_tmx.h"
Index: ruby_2_4/ext/openssl/ossl_bn.c
===================================================================
--- ruby_2_4/ext/openssl/ossl_bn.c	(revision 59822)
+++ ruby_2_4/ext/openssl/ossl_bn.c	(revision 59823)
@@ -953,7 +953,7 @@ ossl_bn_hash(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/ext/openssl/ossl_bn.c#L953
 	ossl_raise(eBNError, NULL);
     }
 
-    hash = INT2FIX(rb_memhash(buf, len));
+    hash = ST2FIX(rb_memhash(buf, len));
     xfree(buf);
 
     return hash;
Index: ruby_2_4/ext/bigdecimal/bigdecimal.c
===================================================================
--- ruby_2_4/ext/bigdecimal/bigdecimal.c	(revision 59822)
+++ ruby_2_4/ext/bigdecimal/bigdecimal.c	(revision 59823)
@@ -382,7 +382,7 @@ BigDecimal_hash(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/ext/bigdecimal/bigdecimal.c#L382
 	hash ^= rb_memhash(p->frac, sizeof(BDIGIT)*p->Prec);
 	hash += p->exponent;
     }
-    return INT2FIX(hash);
+    return ST2FIX(hash);
 }
 
 /*
Index: ruby_2_4/internal.h
===================================================================
--- ruby_2_4/internal.h	(revision 59822)
+++ ruby_2_4/internal.h	(revision 59823)
@@ -330,8 +330,6 @@ ntz_intptr(uintptr_t x) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/internal.h#L330
 VALUE rb_int128t2big(int128_t n);
 #endif
 
-#define ST2FIX(h) LONG2FIX((long)(h))
-
 
 /* arguments must be Fixnum */
 static inline VALUE
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 59822)
+++ ruby_2_4/version.h	(revision 59823)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.2"
 #define RUBY_RELEASE_DATE "2017-09-10"
-#define RUBY_PATCHLEVEL 195
+#define RUBY_PATCHLEVEL 196
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 59822)
+++ ruby_2_4	(revision 59823)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r59765

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

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