ruby-changes:25220
From: tenderlove <ko1@a...>
Date: Sat, 20 Oct 2012 06:20:54 +0900 (JST)
Subject: [ruby-changes:25220] tenderlove:r37271 (trunk): * hash.c (initialize_copy): unset the default proc if there isn't one
tenderlove 2012-10-20 06:20:33 +0900 (Sat, 20 Oct 2012) New Revision: 37271 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37271 Log: * hash.c (initialize_copy): unset the default proc if there isn't one for the target hash, call to_hash, check frozen status. Modified files: trunk/ChangeLog trunk/hash.c Index: ChangeLog =================================================================== --- ChangeLog (revision 37270) +++ ChangeLog (revision 37271) @@ -1,3 +1,8 @@ +Sat Oct 20 06:18:34 2012 Aaron Patterson <aaron@t...> + + * hash.c (initialize_copy): unset the default proc if there isn't one + for the target hash, call to_hash, check frozen status. + Fri Oct 19 22:22:01 2012 Nobuyoshi Nakada <nobu@r...> * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. Index: hash.c =================================================================== --- hash.c (revision 37270) +++ hash.c (revision 37271) @@ -1185,6 +1185,9 @@ 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 @@ 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/