summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 09:53:35 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 09:53:35 +0000
commit776b8b1fd1932221621b85e0a3176cc69ebb0647 (patch)
tree7e3d7b854428b0f18542412f8be1dae2897d3445 /hash.c
parentd2164fc5f2c8d32aaa9a857ca680c8f6d05ed106 (diff)
merge revision(s) 45076: [Backport #9535]
* 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/branches/ruby_2_1@45128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index db510c818e..66cd94bcdd 100644
--- a/hash.c
+++ b/hash.c
@@ -1428,6 +1428,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);