From b91f5c75ede542e87933194956fd0ed76d821e6c Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 8 Nov 2012 05:12:00 +0000 Subject: merge revision(s) 37270: [Backport #7185] * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185] * vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ test/ruby/test_exception.rb | 9 +++++++++ version.h | 2 +- vm.c | 2 +- vm_eval.c | 2 +- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 962434639a..5f369afe11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Nov 8 14:11:49 2012 Nobuyoshi Nakada + + * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. + [ruby-dev:46234] [Bug #7185] + + * vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and + rb_vm_jump_tag_but_local_jump() just jump tag. + Thu Nov 8 14:09:18 2012 Kenta Murata * ext/bigdecimal/bigdecimal.c (BigDecimal_add), diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index f4174eee6e..281dc70fbe 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -92,7 +92,16 @@ class TestException < Test::Unit::TestCase end false }) + end + def test_catch_throw_in_require + bug7185 = '[ruby-dev:46234]' + t = Tempfile.open(["dep", ".rb"]) + t.puts("throw :extdep, 42") + t.close + assert_equal(42, catch(:extdep) {require t.path}, bug7185) + ensure + t.close! if t end def test_else diff --git a/version.h b/version.h index 09b049d21c..bb8a2eb95c 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 307 +#define RUBY_PATCHLEVEL 308 #define RUBY_RELEASE_DATE "2012-11-08" #define RUBY_RELEASE_YEAR 2012 diff --git a/vm.c b/vm.c index 3d7b76e2b9..63141ba717 100644 --- a/vm.c +++ b/vm.c @@ -999,7 +999,7 @@ rb_vm_jump_tag_but_local_jump(int state, VALUE val) { if (val != Qnil) { VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, val); - rb_exc_raise(exc); + if (!NIL_P(exc)) rb_exc_raise(exc); } JUMP_TAG(state); } diff --git a/vm_eval.c b/vm_eval.c index 6f2da3ef6f..0c740285be 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1212,7 +1212,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level) POP_TAG(); rb_set_safe_level_force(safe); - if (state) rb_vm_jump_tag_but_local_jump(state, val); + if (state) JUMP_TAG(state); return val; } -- cgit v1.2.3