summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-05 11:56:11 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-05 11:56:11 +0000
commit60a40ecaf65435c93ad24a4cbb5cd1779aeb2bda (patch)
treeda638a676ad0e7365fa01ca822c3a320ac028921
parentb7d63cbb85e028ab919fa581aee2a748a5f994ab (diff)
* gc.c (rb_obj_id): a Fixnum which is beyond signed long
was converted to a Bignum in calculating its hash. [ruby-dev:39637] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--gc.c2
-rw-r--r--test/ruby/test_hash.rb2
3 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8574f3e75f..860f15c24f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Nov 5 20:49:47 2009 NARUSE, Yui <[email protected]>
+
+ * gc.c (rb_obj_id): a Fixnum which is beyond signed long
+ was converted to a Bignum in calculating its hash.
+ [ruby-dev:39637]
+
Thu Nov 5 12:06:35 2009 NARUSE, Yui <[email protected]>
* parse.y (args): use splat_array.
diff --git a/gc.c b/gc.c
index b7fc7b150c..225932b428 100644
--- a/gc.c
+++ b/gc.c
@@ -2142,7 +2142,7 @@ rb_obj_id(obj)
return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
}
if (SPECIAL_CONST_P(obj)) {
- return LONG2NUM((long)obj);
+ return LONG2FIX((long)obj);
}
return (VALUE)((long)obj|FIXNUM_FLAG);
}
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 4131a6bdd3..f2ff95464d 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -637,5 +637,7 @@ class TestHash < Test::Unit::TestCase
def test_hash_hash
assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash)
+ assert_equal({:a=>2**29}.hash, {:a=>2**29}.hash)
+ assert_equal({:a=>2**61}.hash, {:a=>2**61}.hash)
end
end