diff options
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1185,6 +1185,9 @@ replace_i(VALUE key, VALUE val, VALUE hash) static VALUE rb_hash_initialize_copy(VALUE hash, VALUE hash2) { + rb_hash_modify_check(hash); + hash2 = to_hash(hash2); + Check_Type(hash2, T_HASH); if (!RHASH_EMPTY_P(hash2)) { @@ -1195,6 +1198,9 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2) if (FL_TEST(hash2, HASH_PROC_DEFAULT)) { FL_SET(hash, HASH_PROC_DEFAULT); } + else { + FL_UNSET(hash, HASH_PROC_DEFAULT); + } RHASH_IFNONE(hash) = RHASH_IFNONE(hash2); return hash; |