diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-30 12:53:22 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-30 12:53:22 +0000 |
commit | cae4321112270231e3a4aa8c53c07df194a67dc8 (patch) | |
tree | 4fe3fd4d3be0c86d44a08d7db3994d278dad7eca | |
parent | 4b8d9cffdd7d74b858d872840d615c8b82ceaa4f (diff) |
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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_yield.rb | 22 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | vm.c | 4 |
4 files changed, 30 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Tue Oct 27 05:56:39 2009 NARUSE, Yui <naruse@ruby-lang.org> + + * 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@ruby-lang.org> * 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 2a2c6ae80f..3c91ed14de 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' @@ -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 @@ -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; |