summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-02-11 21:21:19 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-02-11 21:58:47 +0900
commit1f2d786e3220ecb6b3ff95e31f538ce338374c54 (patch)
tree4941d5c44d98ae3c727647ee84ec283ff5657106 /src
parentff03a9a61c62340cff62f8e0fdc1a1e8775b6f17 (diff)
downloadmruby-1f2d786e3220ecb6b3ff95e31f538ce338374c54.tar.gz
mruby-1f2d786e3220ecb6b3ff95e31f538ce338374c54.zip
Avoid direct return from ecall(); fix #3441
There's incompatibility left for mruby. When you return from `ensure` clause, mruby simply ignores the return value. CRuby returns from the method squashing the exception raised. ``` def f no_such_method() # NoMethodError ensure return 22 end p f() # CRuby prints `22` ```
Diffstat (limited to 'src')
-rw-r--r--src/vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vm.c b/src/vm.c
index 276e2ab6d..70583864e 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1652,7 +1652,7 @@ RETRY_TRY_BLOCK:
switch (GETARG_B(i)) {
case OP_R_RETURN:
/* Fall through to OP_R_NORMAL otherwise */
- if (proc->env && !MRB_PROC_STRICT_P(proc)) {
+ if (ci->acc >=0 && proc->env && !MRB_PROC_STRICT_P(proc)) {
struct REnv *e = top_env(mrb, proc);
if (!MRB_ENV_STACK_SHARED_P(e)) {