commit cae4321112270231e3a4aa8c53c07df194a67dc8 Author: yugui Date: Sat Jan 30 12:53:22 2010 +0000 merges r25494 from trunk into ruby_1_9_1. adds a test case for the change -- * vm.c (invoke_block_from_c): return Qnil when its iseq is SPECIAL CONST. [ruby-core:26335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@26506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e diff --git a/ChangeLog b/ChangeLog index fc42212..c1043fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Oct 27 05:56:39 2009 NARUSE, Yui + + * vm.c (invoke_block_from_c): return Qnil when its iseq is + SPECIAL CONST. [ruby-core:26335] + Mon Oct 26 12:06:27 2009 Nobuyoshi Nakada * io.c (io_fwrite): adjust stdio file position after direct write on diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb index 2a2c6ae..3c91ed1 100644 --- a/test/ruby/test_yield.rb +++ b/test/ruby/test_yield.rb @@ -1,7 +1,7 @@ require 'test/unit' +require_relative 'envutil' class TestRubyYield < Test::Unit::TestCase - def test_ary_each ary = [1] ary.each {|a, b, c, d| assert_equal [1,nil,nil,nil], [a,b,c,d] } @@ -83,6 +83,26 @@ class TestRubyYield < Test::Unit::TestCase } assert_equal([1,2,[3],4,5], r, "[ruby-core:19485]") end + + def test_through_a_method_defined_by_define_method + assert_normal_exit(<<-EOS, "[ruby-core:26335]") + class C + def meth + yield 1 + end + end + + class D < C + define_method(:meth) do + super() + end + end + begin + D.new.meth {} + rescue LocalJumpError + end + EOS + end end require_relative 'sentence' diff --git a/version.h b/version.h index 76effda..f578844 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 411 +#define RUBY_PATCHLEVEL 412 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 diff --git a/vm.c b/vm.c index f357156..dfdcb17 100644 --- a/vm.c +++ b/vm.c @@ -493,7 +493,9 @@ invoke_block_from_c(rb_thread_t *th, const rb_block_t *block, VALUE self, int argc, const VALUE *argv, const rb_block_t *blockptr, const NODE *cref) { - if (BUILTIN_TYPE(block->iseq) != T_NODE) { + if (SPECIAL_CONST_P(block->iseq)) + return Qnil; + else if (BUILTIN_TYPE(block->iseq) != T_NODE) { const rb_iseq_t *iseq = block->iseq; const rb_control_frame_t *cfp; int i, opt_pc, arg_size = iseq->arg_size;