Remove check for rb_obj_gen_fields_p in rb_hash_dup

rb_copy_generic_ivar already checks for it, so we don't need to call
rb_obj_gen_fields_p twice.
This commit is contained in:
Peter Zhu 2026-01-07 19:56:49 -05:00
parent 523857bfcb
commit c6f9a4d393
Notes: git 2026-01-08 22:33:59 +00:00

5
hash.c
View File

@ -1558,9 +1558,8 @@ rb_hash_dup(VALUE hash)
const VALUE flags = RBASIC(hash)->flags;
VALUE ret = hash_dup(hash, rb_obj_class(hash), flags & RHASH_PROC_DEFAULT);
if (rb_obj_gen_fields_p(hash)) {
rb_copy_generic_ivar(ret, hash);
}
rb_copy_generic_ivar(ret, hash);
return ret;
}