diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-18 00:24:00 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-18 00:24:00 +0000 |
commit | a34a3c2caae4c1fbd9b4a0fa7194e0edfbad6bbe (patch) | |
tree | e6ecfaf77e13023217c22fcb83bbda11b2ebccc1 /hash.c | |
parent | bff930ccf476e1a7e01720e2fd4f6c09d226a56f (diff) |
* hash.c (initialize_copy): duping should rehash the hash.
* test/ruby/test_hash.rb: added a test to ensure rehash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1187,8 +1187,11 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2) { Check_Type(hash2, T_HASH); - if (!RHASH_EMPTY_P(hash2)) + if (!RHASH_EMPTY_P(hash2)) { RHASH(hash)->ntbl = st_copy(RHASH(hash2)->ntbl); + rb_hash_rehash(hash); + } + if (FL_TEST(hash2, HASH_PROC_DEFAULT)) { FL_SET(hash, HASH_PROC_DEFAULT); } |