aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-09 00:06:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-09 00:12:54 +0900
commitad3f7a3667d79a7d23c78e026d3eb5a42bd0b7b3 (patch)
tree02b716c3034207989fbf72e1f7766cee31171230 /load.c
parenta206738762ea788830e8b3ac58b37d705595a6fb (diff)
downloadruby-ad3f7a3667d79a7d23c78e026d3eb5a42bd0b7b3.tar.gz
Should require without wrapper module
Diffstat (limited to 'load.c')
-rw-r--r--load.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/load.c b/load.c
index 8b872a81b7..c3d1d63aeb 100644
--- a/load.c
+++ b/load.c
@@ -978,6 +978,9 @@ static int
require_internal(rb_execution_context_t *ec, VALUE fname, int safe, int exception)
{
volatile int result = -1;
+ rb_thread_t *th = rb_ec_thread_ptr(ec);
+ volatile VALUE wrapper = th->top_wrapper;
+ volatile VALUE self = th->top_self;
volatile VALUE errinfo = ec->errinfo;
enum ruby_tag_type state;
struct {
@@ -993,6 +996,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int safe, int exceptio
EC_PUSH_TAG(ec);
saved.safe = rb_safe_level();
ec->errinfo = Qnil; /* ensure */
+ th->top_wrapper = 0;
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
long handle;
int found;
@@ -1029,6 +1033,9 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int safe, int exceptio
}
}
EC_POP_TAG();
+ th = rb_ec_thread_ptr(ec);
+ th->top_self = self;
+ th->top_wrapper = wrapper;
if (ftptr) load_unlock(RSTRING_PTR(path), !state);
rb_set_safe_level_force(saved.safe);