summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 5172e13b57..bf9dbd5467 100644
--- a/hash.c
+++ b/hash.c
@@ -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);
}