diff options
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1972,9 +1972,12 @@ static VALUE rb_hash_s_ruby2_keywords_hash(VALUE dummy, VALUE hash) { Check_Type(hash, T_HASH); - hash = rb_hash_dup(hash); - RHASH(hash)->basic.flags |= RHASH_PASS_AS_KEYWORDS; - return hash; + VALUE tmp = rb_hash_dup(hash); + if (RHASH_EMPTY_P(hash) && rb_hash_compare_by_id_p(hash)) { + rb_hash_compare_by_id(tmp); + } + RHASH(tmp)->basic.flags |= RHASH_PASS_AS_KEYWORDS; + return tmp; } struct rehash_arg { |