aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 15:21:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 16:10:39 +0900
commit7d6903dc476f982e7b432adbeef3a3d9372a309f (patch)
tree3847e6cc91b7ca311fda9cd885a0bef908bf898a /load.c
parent9cdc964d075fc3d21b8ce8456ac88f57a5183ec0 (diff)
downloadruby-7d6903dc476f982e7b432adbeef3a3d9372a309f.tar.gz
Add the loaded feature after no exception raised
Retrying after rescued `require` should try to load the same library again. [Bug #16607]
Diffstat (limited to 'load.c')
-rw-r--r--load.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/load.c b/load.c
index 70a04756c6..0cb0dd3cfa 100644
--- a/load.c
+++ b/load.c
@@ -1014,7 +1014,6 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
result = 0;
}
else if (!*ftptr) {
- rb_provide_feature(path);
result = TAG_RETURN;
}
else {
@@ -1029,7 +1028,6 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
}
- rb_provide_feature(path);
result = TAG_RETURN;
}
}
@@ -1063,6 +1061,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
rb_exc_raise(ec->errinfo);
}
+ if (result == TAG_RETURN) rb_provide_feature(path);
ec->errinfo = errinfo;
RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));