mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
singleton_class should not be duped; fix #2815
This commit is contained in:
@@ -369,6 +369,9 @@ mrb_obj_dup(mrb_state *mrb, mrb_value obj)
|
||||
if (mrb_immediate_p(obj)) {
|
||||
mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %S", obj);
|
||||
}
|
||||
if (mrb_type(obj) == MRB_TT_SCLASS) {
|
||||
mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class");
|
||||
}
|
||||
p = mrb_obj_alloc(mrb, mrb_type(obj), mrb_obj_class(mrb, obj));
|
||||
dup = mrb_obj_value(p);
|
||||
init_copy(mrb, dup, obj);
|
||||
|
||||
Reference in New Issue
Block a user