From 1d4976c0cf6ebf321f61f6fe83bf91f7fe101d8d Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 20 Jan 2017 01:02:37 +0000 Subject: [PATCH] error.c: print default RS * error.c (rb_warn_m): print the default RS instead of an empty string with a newline. [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/error.c b/error.c index d4c38f8cbb..0ec0cf895a 100644 --- a/error.c +++ b/error.c @@ -303,7 +303,10 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc) VALUE str; for (i = 0; i < argc; i++) { str = rb_obj_as_string(argv[i]); - if (RSTRING_LEN(str) == 0 || !rb_str_end_with_asciichar(str, '\n')) { + if (RSTRING_LEN(str) == 0) { + str = rb_default_rs; + } + else if (!rb_str_end_with_asciichar(str, '\n')) { str = rb_str_cat(rb_str_dup(str), "\n", 1); } rb_write_warning_str(str);