diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | bootstraptest/test_flow.rb | 21 | ||||
-rw-r--r-- | vm.c | 7 |
3 files changed, 28 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Wed Feb 10 04:06:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * vm.c (vm_exec): reset thread state before starting vm loop. + [ruby-core:28129] + Tue Feb 9 23:48:25 2010 Yusuke Endoh <mame@tsg.ne.jp> * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too. diff --git a/bootstraptest/test_flow.rb b/bootstraptest/test_flow.rb index 46ca1a0c6a..84ef216421 100644 --- a/bootstraptest/test_flow.rb +++ b/bootstraptest/test_flow.rb @@ -502,3 +502,24 @@ assert_equal %Q{ENSURE\n}, %q{ test }, '[ruby-dev:37967]' +[['[ruby-core:28129]', %q{ + class Bug2728 + include Enumerable + define_method(:dynamic_method) do + "dynamically defined method" + end + def each + begin + yield :foo + ensure + dynamic_method + end + end + end + e = Bug2728.new +}]].each do |bug, src| + assert_equal "foo", src + %q{e.detect {true}}, bug + assert_equal "true", src + %q{e.any? {true}}, bug + assert_equal "false", src + %q{e.all? {false}}, bug + assert_equal "true", src + %q{e.include?(:foo)}, bug +end @@ -1121,6 +1121,8 @@ vm_exec(rb_thread_t *th) _tag.retval = Qnil; if ((state = EXEC_TAG()) == 0) { vm_loop_start: + th->state = 0; + th->errinfo = Qnil; result = vm_exec_core(th, initial); if ((state = th->state) != 0) { err = result; @@ -1189,7 +1191,6 @@ vm_exec(rb_thread_t *th) #else *th->cfp->sp++ = (GET_THROWOBJ_VAL(err)); #endif - th->errinfo = Qnil; goto vm_loop_start; } } @@ -1226,7 +1227,6 @@ vm_exec(rb_thread_t *th) escape_dfp = GET_THROWOBJ_CATCH_POINT(err); if (cfp->dfp == escape_dfp) { cfp->pc = cfp->iseq->iseq_encoded + entry->cont; - th->errinfo = Qnil; goto vm_loop_start; } } @@ -1258,7 +1258,6 @@ vm_exec(rb_thread_t *th) *th->cfp->sp++ = (GET_THROWOBJ_VAL(err)); #endif } - th->errinfo = Qnil; goto vm_loop_start; } } @@ -1302,8 +1301,6 @@ vm_exec(rb_thread_t *th) cfp->self, (VALUE)cfp->dfp, catch_iseq->iseq_encoded, cfp->sp + 1 /* push value */, cfp->lfp, catch_iseq->local_size - 1); - state = 0; - th->errinfo = Qnil; goto vm_loop_start; } else { |