From 8889992b75f85c8080fc09c7a3a1cb6123a098c1 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 16:38:05 -0400 Subject: Fix remove_instance_variable for too complex class --- variable.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'variable.c') 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)) { -- cgit v1.2.3