mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm.c: pass through thrown objects
* 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/trunk@37270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b0e40509c3
commit
2fe13f62ef
4 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Fri Oct 19 22:22:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Fri Oct 19 22:11:55 2012 Benoit Daloze <eregontp@gmail.com>
|
Fri Oct 19 22:11:55 2012 Benoit Daloze <eregontp@gmail.com>
|
||||||
|
|
||||||
* pack.c (pack_unpack): set encoding of the
|
* pack.c (pack_unpack): set encoding of the
|
||||||
|
|
|
@ -104,7 +104,16 @@ class TestException < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
false
|
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
|
end
|
||||||
|
|
||||||
def test_else_no_exception
|
def test_else_no_exception
|
||||||
|
|
2
vm.c
2
vm.c
|
@ -916,7 +916,7 @@ rb_vm_jump_tag_but_local_jump(int state, VALUE val)
|
||||||
{
|
{
|
||||||
if (val != Qnil) {
|
if (val != Qnil) {
|
||||||
VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, val);
|
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);
|
JUMP_TAG(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
||||||
rb_set_safe_level_force(safe);
|
rb_set_safe_level_force(safe);
|
||||||
if (state) rb_vm_jump_tag_but_local_jump(state, val);
|
if (state) JUMP_TAG(state);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue