summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 15:27:37 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 15:27:37 +0000
commitac84c2aee2c576247e7961491904f909e8b9ab66 (patch)
tree787b4abcbc340d18c24471455a2102c945c598ba /load.c
parent4237809aa3983fca36b520f95b48fdf9e7e88de2 (diff)
merge revision(s) 58471,58493: [Backport #13505]
load.c: backtrace of circular require * load.c (load_lock): print backtrace of circular require via `Warning.warn` [ruby-core:80850] [Bug #13505] Send the backtrace of the circular require warning as a single String to Warning.warn * load.c: send as a single string. * error.c: expose the string formatted by rb_warning as rb_warning_string(). * test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/load.c b/load.c
index 88e31e26f8..7778d4f87c 100644
--- a/load.c
+++ b/load.c
@@ -720,6 +720,8 @@ rb_f_load(int argc, VALUE *argv)
return Qtrue;
}
+extern VALUE rb_mWarning;
+
static char *
load_lock(const char *ftptr)
{
@@ -742,8 +744,9 @@ load_lock(const char *ftptr)
return (char *)"";
}
if (RTEST(ruby_verbose)) {
- rb_warning("loading in progress, circular require considered harmful - %s", ftptr);
- rb_backtrace_print_to(rb_stderr);
+ VALUE warning = rb_warning_string("loading in progress, circular require considered harmful - %s", ftptr);
+ rb_backtrace_each(rb_str_append, warning);
+ rb_warning_warn(rb_mWarning, warning);
}
switch (rb_thread_shield_wait((VALUE)data)) {
case Qfalse: