diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-10-03 17:59:54 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-10-03 17:59:54 +0900 |
| commit | 5b2ec0eb1be663ff6d3bc12660d48b1e25375353 (patch) | |
| tree | 91c79c5a95545c6b274a531af206603d70f4f096 | |
| parent | c93b521fac3e92935b64ba8d802c87048a5769d6 (diff) | |
Save `ns` that may be clobbered by `setjmp`/`longjmp`
| -rw-r--r-- | load.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1289,14 +1289,15 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa { volatile int result = -1; rb_thread_t *th = rb_ec_thread_ptr(ec); + const rb_namespace_t *ns = rb_loading_namespace(); volatile const struct { VALUE wrapper, self, errinfo; rb_execution_context_t *ec; + const rb_namespace_t *ns; } saved = { th->top_wrapper, th->top_self, ec->errinfo, - ec, + ec, ns, }; - const rb_namespace_t *ns = rb_loading_namespace(); enum ruby_tag_type state; char *volatile ftptr = 0; VALUE path; @@ -1365,6 +1366,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa EC_POP_TAG(); ec = saved.ec; + ns = saved.ns; rb_thread_t *th2 = rb_ec_thread_ptr(ec); th2->top_self = saved.self; th2->top_wrapper = saved.wrapper; |
