diff --git a/hash.c b/hash.c index d346a52..d50c488 100644 --- a/hash.c +++ b/hash.c @@ -1311,7 +1311,11 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2) Check_Type(hash2, T_HASH); - if (!RHASH_EMPTY_P(hash2)) { + if (RHASH_EMPTY_P(hash2)) { + if (RHASH(hash2)->ntbl) + hash_tbl(hash)->type = RHASH(hash2)->ntbl->type; + } + else { RHASH(hash)->ntbl = st_copy(RHASH(hash2)->ntbl); rb_hash_rehash(hash); }