rb_copy_generic_ivar: reset shape_id when no ivar are present
This commit is contained in:
parent
1e33a451bb
commit
22c09135a8
Notes:
git
2025-05-16 18:17:05 +00:00
4
object.c
4
object.c
@ -409,10 +409,12 @@ init_copy(VALUE dest, VALUE obj)
|
||||
RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR);
|
||||
// Copies the shape id from obj to dest
|
||||
RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR);
|
||||
rb_copy_generic_ivar(dest, obj);
|
||||
if (RB_TYPE_P(obj, T_OBJECT)) {
|
||||
rb_obj_copy_ivar(dest, obj);
|
||||
}
|
||||
else {
|
||||
rb_copy_generic_ivar(dest, obj);
|
||||
}
|
||||
rb_gc_copy_attributes(dest, obj);
|
||||
}
|
||||
|
||||
|
@ -2438,6 +2438,9 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
|
||||
|
||||
clear:
|
||||
if (FL_TEST(dest, FL_EXIVAR)) {
|
||||
#if SHAPE_IN_BASIC_FLAGS
|
||||
RBASIC_SET_SHAPE_ID(dest, ROOT_SHAPE_ID);
|
||||
#endif
|
||||
rb_free_generic_ivar(dest);
|
||||
FL_UNSET(dest, FL_EXIVAR);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user