diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-16 15:27:37 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-16 15:27:37 +0000 |
commit | ac84c2aee2c576247e7961491904f909e8b9ab66 (patch) | |
tree | 787b4abcbc340d18c24471455a2102c945c598ba /load.c | |
parent | 4237809aa3983fca36b520f95b48fdf9e7e88de2 (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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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: |