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

When splitting a keyword hash, dup it first to not mutate it

This commit is contained in:
Jeremy Evans 2019-08-17 22:47:43 -07:00
parent 5c507db467
commit 16cd0de6ec
Notes: git 2019-08-31 04:40:14 +09:00

View file

@ -241,6 +241,7 @@ keyword_hash_p(VALUE *kw_hash_ptr, VALUE *rest_hash_ptr, int check_only_symbol)
*kw_hash_ptr = Qnil;
return FALSE;
case KW_HASH_HAS_BOTH_KEYS:
*rest_hash_ptr = rb_hash_dup(*rest_hash_ptr);
keyword_hash_split(kw_hash_ptr, rest_hash_ptr);
return TRUE;
}