summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-16 16:08:21 +0200
committerJean Boussier <[email protected]>2025-05-16 20:16:52 +0200
commit22c09135a8c459dd09f4fb9a6e9124d4a149083b (patch)
treef18c3747fc5939799cfee6d136676888ea063205 /object.c
parent1e33a451bbbec1ffa15fc3032a0bdd74bd9b41ff (diff)
rb_copy_generic_ivar: reset shape_id when no ivar are present
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13350
Diffstat (limited to 'object.c')
-rw-r--r--object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/object.c b/object.c
index 15eeda8689..f5f5759d11 100644
--- a/object.c
+++ b/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);
}