1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (rb_hash_replace): should copy compare_by_identity status as well.

[ruby-core:24728]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-08-03 22:44:45 +00:00
parent d6b9cc7baa
commit e00b83ceb9
2 changed files with 9 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Tue Aug 4 06:30:01 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (rb_hash_replace): should copy compare_by_identity status as well.
[ruby-core:24728]
Tue Aug 4 05:43:03 2009 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Aug 4 05:43:03 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* thread.c (recursive_push): need to set UNTRUST. [ruby-dev:38997] * thread.c (recursive_push): need to set UNTRUST. [ruby-dev:38997]

4
hash.c
View file

@ -1060,6 +1060,10 @@ rb_hash_replace(VALUE hash, VALUE hash2)
hash2 = to_hash(hash2); hash2 = to_hash(hash2);
if (hash == hash2) return hash; if (hash == hash2) return hash;
rb_hash_clear(hash); rb_hash_clear(hash);
if (RHASH(hash2)->ntbl) {
rb_hash_tbl(hash);
RHASH(hash)->ntbl->type = RHASH(hash2)->ntbl->type;
}
rb_hash_foreach(hash2, replace_i, hash); rb_hash_foreach(hash2, replace_i, hash);
RHASH(hash)->ifnone = RHASH(hash2)->ifnone; RHASH(hash)->ifnone = RHASH(hash2)->ifnone;
if (FL_TEST(hash2, HASH_PROC_DEFAULT)) { if (FL_TEST(hash2, HASH_PROC_DEFAULT)) {