summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-13 01:34:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-13 01:34:52 (GMT)
commit8a2a882e53ade974494dbf7c968a85bad0393dcd (patch)
tree6f223bb27bd1fd97c9e0f5439d34a760ebfdb22f /error.c
parent6a16d03365a565cbf22f148e997dca55d63cb00b (diff)
error.c: infinite recursion at Warning#warn
* error.c (rb_warn_m): write the message to rb_stderr directly, to get rid of infinite recursion when called on Warning module itself, by super in redefined Warning#warn. [ruby-dev:50293] [Bug #14006] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/error.c b/error.c
index ffdd1a4..7f9e582 100644
--- a/error.c
+++ b/error.c
@@ -329,7 +329,13 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc)
rb_io_puts(argc, argv, str);
RBASIC_SET_CLASS(str, rb_cString);
}
- rb_write_warning_str(str);
+ if (exc == rb_mWarning) {
+ rb_must_asciicompat(str);
+ rb_write_error_str(str);
+ }
+ else {
+ rb_write_warning_str(str);
+ }
}
return Qnil;
}