summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-08 21:26:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-08 21:27:39 +0900
commit76bd0714cf1140ffd64bf564446c76c54f2c4870 (patch)
tree39c0ffefa8ff92fb63a5cbd0d089a745d2912fd0
parent3d87b774c4e38e0dbe3ef181183565c5987cd05f (diff)
solve "duplicate :raise event" in require too [Bug #15877]
-rw-r--r--load.c1
-rw-r--r--test/ruby/test_settracefunc.rb8
2 files changed, 7 insertions, 2 deletions
diff --git a/load.c b/load.c
index cc5533e..ba84ec0 100644
--- a/load.c
+++ b/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) {
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index 7d7b672..1138427 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -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