mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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.
This commit is contained in:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user