From 1f29e8e2baa548bba9e385ebbade2198b4cc3859 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 21 Feb 2014 11:42:03 +0000 Subject: class.c: do nothing if copying self * class.c (rb_mod_init_copy): do nothing if copying self. [ruby-dev:47989] [Bug #9535] * hash.c (rb_hash_initialize_copy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 87438dfbf8..ccc0d448f1 100644 --- a/hash.c +++ b/hash.c @@ -1403,6 +1403,8 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2) Check_Type(hash2, T_HASH); + if (hash == hash2) return hash; + ntbl = RHASH(hash)->ntbl; if (RHASH(hash2)->ntbl) { if (ntbl) st_free_table(ntbl); -- cgit v1.2.3