From 568309b25a82188bb97d202563ab27e9e248956f Mon Sep 17 00:00:00 2001 From: dearblue Date: Mon, 4 Dec 2023 21:51:02 +0900 Subject: [PATCH] Propagating exceptions to the caller of `Fiber#resume` Need to return control from `mrb_vm_exec()` to the caller if `Fiber#resume` was done from C. --- src/vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vm.c b/src/vm.c index 6e776f9de..50c7b0b08 100644 --- a/src/vm.c +++ b/src/vm.c @@ -2244,7 +2244,10 @@ RETRY_TRY_BLOCK: mrb->c = c->prev; if (!mrb->c) mrb->c = mrb->root_c; else c->prev = NULL; - goto L_RAISE; + if (!c->vmexec) goto L_RAISE; + mrb->jmp = prev_jmp; + if (!prev_jmp) return mrb_obj_value(mrb->exc); + MRB_THROW(prev_jmp); } }