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

ruby-changes:55263

From: nobu <ko1@a...>
Date: Mon, 8 Apr 2019 14:06:47 +0900 (JST)
Subject: [ruby-changes:55263] nobu:r67470 (trunk): struct.c: force hash values fixable

nobu	2019-04-08 14:06:43 +0900 (Mon, 08 Apr 2019)

  New Revision: 67470

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

  Log:
    struct.c: force hash values fixable
    
    * struct.c (rb_struct_hash): force hash values fixable on LLP64
      environment.

  Modified files:
    trunk/struct.c
    trunk/test/ruby/test_struct.rb
Index: test/ruby/test_struct.rb
===================================================================
--- test/ruby/test_struct.rb	(revision 67469)
+++ test/ruby/test_struct.rb	(revision 67470)
@@ -275,6 +275,7 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/test/ruby/test_struct.rb#L275
     klass = @Struct.new(:a)
     o = klass.new(1)
     assert_kind_of(Integer, o.hash)
+    assert_kind_of(String, o.hash.to_s)
   end
 
   def test_eql
Index: struct.c
===================================================================
--- struct.c	(revision 67469)
+++ struct.c	(revision 67470)
@@ -1202,7 +1202,7 @@ rb_struct_hash(VALUE s) https://github.com/ruby/ruby/blob/trunk/struct.c#L1202
 	h = rb_hash_uint(h, NUM2LONG(n));
     }
     h = rb_hash_end(h);
-    return INT2FIX(h);
+    return ST2FIX(h);
 }
 
 static VALUE

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

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