1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

solve "duplicate :raise event" in require too [Bug #15877]

This commit is contained in:
Nobuyoshi Nakada 2019-08-08 21:26:31 +09:00
parent 3d87b774c4
commit 76bd0714cf
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 7 additions and 2 deletions

1
load.c
View file

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

View file

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