From 8bab20ef7c227eba957c91674106e7fc5c3a1c41 Mon Sep 17 00:00:00 2001 From: dearblue Date: Sat, 25 Jun 2022 11:45:18 +0900 Subject: [PATCH] Do not expand "included class" in `mrb_proc_new()`. If `target_class->tt` is `MRB_TT_ICLASS`, it may cause loss of class inheritance relationships. This problem is caused by #5402. ref. #5725 --- src/proc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/proc.c b/src/proc.c index 100e04150..bbc4a2b14 100644 --- a/src/proc.c +++ b/src/proc.c @@ -52,15 +52,7 @@ mrb_proc_new(mrb_state *mrb, const mrb_irep *irep) struct RClass *tc = NULL; if (ci->proc) { - if (ci->proc->color != MRB_GC_RED) { - tc = MRB_PROC_TARGET_CLASS(ci->proc); - } - else { - tc = mrb_vm_ci_target_class(ci); - if (tc && tc->tt == MRB_TT_ICLASS) { - tc = tc->c; - } - } + tc = MRB_PROC_TARGET_CLASS(ci->proc); } if (tc == NULL) { tc = mrb_vm_ci_target_class(ci);