ruby-changes:14658
From: yugui <ko1@a...>
Date: Sat, 30 Jan 2010 22:07:27 +0900 (JST)
Subject: [ruby-changes:14658] Ruby:r26506 (ruby_1_9_1): merges r25494 from trunk into ruby_1_9_1.
yugui 2010-01-30 21:53:22 +0900 (Sat, 30 Jan 2010) New Revision: 26506 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26506 Log: 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] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/test/ruby/test_yield.rb branches/ruby_1_9_1/version.h branches/ruby_1_9_1/vm.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 26505) +++ ruby_1_9_1/ChangeLog (revision 26506) @@ -1,3 +1,8 @@ +Tue Oct 27 05:56:39 2009 NARUSE, Yui <naruse@r...> + + * 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 <nobu@r...> * io.c (io_fwrite): adjust stdio file position after direct write on Index: ruby_1_9_1/vm.c =================================================================== --- ruby_1_9_1/vm.c (revision 26505) +++ ruby_1_9_1/vm.c (revision 26506) @@ -493,7 +493,9 @@ 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; Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 26505) +++ ruby_1_9_1/version.h (revision 26506) @@ -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 Index: ruby_1_9_1/test/ruby/test_yield.rb =================================================================== --- ruby_1_9_1/test/ruby/test_yield.rb (revision 26505) +++ ruby_1_9_1/test/ruby/test_yield.rb (revision 26506) @@ -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 @@ } 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' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/