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
This commit is contained in:
yugui 2010-01-30 12:53:22 +00:00
parent 4b8d9cffdd
commit cae4321112
4 changed files with 30 additions and 3 deletions

View File

@ -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

View File

@ -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'

View File

@ -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

4
vm.c
View File

@ -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;