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

ruby-changes:55259

From: nobu <ko1@a...>
Date: Mon, 8 Apr 2019 12:26:34 +0900 (JST)
Subject: [ruby-changes:55259] nobu:r67466 (trunk): enumerator.c: force hash values fixable

nobu	2019-04-08 12:26:27 +0900 (Mon, 08 Apr 2019)

  New Revision: 67466

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

  Log:
    enumerator.c: force hash values fixable
    
    * enumerator.c (arith_seq_hash): force hash values fixable on
      LLP64 environment.  [ruby-core:92190] [Bug #15755]

  Modified files:
    trunk/enumerator.c
    trunk/test/ruby/test_arithmetic_sequence.rb
Index: enumerator.c
===================================================================
--- enumerator.c	(revision 67465)
+++ enumerator.c	(revision 67466)
@@ -3345,7 +3345,7 @@ arith_seq_hash(VALUE self) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L3345
     hash = rb_hash_uint(hash, NUM2LONG(v));
     hash = rb_hash_end(hash);
 
-    return LONG2FIX(hash);
+    return ST2FIX(hash);
 }
 
 #define NUM_GE(x, y) RTEST(rb_num_coerce_relop((x), (y), idGE))
Index: test/ruby/test_arithmetic_sequence.rb
===================================================================
--- test/ruby/test_arithmetic_sequence.rb	(revision 67465)
+++ test/ruby/test_arithmetic_sequence.rb	(revision 67466)
@@ -127,6 +127,7 @@ class TestArithmeticSequence < Test::Uni https://github.com/ruby/ruby/blob/trunk/test/ruby/test_arithmetic_sequence.rb#L127
     assert_equal(seq.hash, seq.hash)
     assert_equal(seq.hash, 1.step.hash)
     assert_equal(seq.hash, 1.step(nil).hash)
+    assert_kind_of(String, seq.hash.to_s)
   end
 
   def test_first

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

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