зеркало из https://github.com/github/ruby.git
solve "duplicate :raise event" in require too [Bug #15877]
This commit is contained in:
Родитель
3d87b774c4
Коммит
76bd0714cf
1
load.c
1
load.c
|
@ -1053,7 +1053,6 @@ rb_require_safe(VALUE fname, int safe)
|
|||
int result = rb_require_internal(fname, safe);
|
||||
|
||||
if (result > TAG_RETURN) {
|
||||
if (result == TAG_RAISE) rb_exc_raise(rb_errinfo());
|
||||
EC_JUMP_TAG(GET_EC(), result);
|
||||
}
|
||||
if (result < 0) {
|
||||
|
|
|
@ -1676,10 +1676,16 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
tmpdir = Dir.mktmpdir
|
||||
path = "#{tmpdir}/hola.rb"
|
||||
File.open(path, "w") { |f| f.write("raise") }
|
||||
TracePoint.new(:raise){|tp| next if !target_thread?; events << [tp.event]}.enable{
|
||||
tp = TracePoint.new(:raise) {|tp| events << [tp.event] if target_thread?}
|
||||
tp.enable{
|
||||
load path rescue nil
|
||||
}
|
||||
assert_equal [[:raise]], events
|
||||
events.clear
|
||||
tp.enable{
|
||||
require path rescue nil
|
||||
}
|
||||
assert_equal [[:raise]], events
|
||||
ensure
|
||||
FileUtils.rmtree(tmpdir)
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче