Skip to content
Permalink
Browse files Browse the repository at this point in the history
Allow Object#clone to copy frozen status only; fix #4036
Copying all flags from the original object may overwrite the clone's
flags e.g. the embedded flag.
  • Loading branch information
matz committed Jun 7, 2018
1 parent cfd0c93 commit 55edae0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kernel.c
Expand Up @@ -348,7 +348,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);
clone = mrb_obj_value(p);
init_copy(mrb, clone, self);
p->flags = mrb_obj_ptr(self)->flags;
p->flags |= mrb_obj_ptr(self)->flags & MRB_FLAG_IS_FROZEN;

return clone;
}
Expand Down

0 comments on commit 55edae0

Please sign in to comment.