aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-10-31 16:38:05 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-10-31 16:38:05 -0400
commit8889992b75f85c8080fc09c7a3a1cb6123a098c1 (patch)
tree878ff46f9cf87dd5707644690ef748f563f75751 /variable.c
parentb7a3e2e71dc68ec56036f37ab5a1f94489436f96 (diff)
downloadruby-8889992b75f85c8080fc09c7a3a1cb6123a098c1.tar.gz
Fix remove_instance_variable for too complex class
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index f179b8b612..a374756974 100644
--- a/variable.c
+++ b/variable.c
@@ -2198,7 +2198,12 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
case T_CLASS:
case T_MODULE:
IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(id);
- rb_shape_transition_shape_remove_ivar(obj, id, shape, &val);
+ if (rb_shape_obj_too_complex(obj)) {
+ st_delete(RCLASS_IV_HASH(obj), (st_data_t *)&id, (st_data_t *)&val);
+ }
+ else {
+ rb_shape_transition_shape_remove_ivar(obj, id, shape, &val);
+ }
break;
case T_OBJECT: {
if (rb_shape_obj_too_complex(obj)) {