Project

General

Profile

Feature #12944 ยป 0001-Restore-behavior-of-Kernel-warn-accepting-arrays-arg.patch

Eregon (Benoit Daloze), 04/25/2017 12:06 PM

View differences:

error.c
302 302
rb_warn_m(int argc, VALUE *argv, VALUE exc)
303 303
{
304 304
    if (!NIL_P(ruby_verbose) && argc > 0) {
305
	int i;
306 305
	VALUE str;
307
	for (i = 0; i < argc; i++) {
308
	    str = rb_obj_as_string(argv[i]);
309
	    if (RSTRING_LEN(str) == 0) {
310
		str = rb_default_rs;
311
	    }
312
	    else if (!rb_str_end_with_asciichar(str, '\n')) {
313
		str = rb_str_cat(rb_str_dup(str), "\n", 1);
314
	    }
315
	    rb_write_warning_str(str);
306
	str = rb_ary_new_from_values(argc, argv);
307
	str = rb_ary_join(str, rb_str_new("\n", 1));
308
	if (RSTRING_LEN(str) == 0 || !rb_str_end_with_asciichar(str, '\n')) {
309
	    rb_str_cat(str, "\n", 1);
316 310
	}
311
	rb_write_warning_str(str);
317 312
    }
318 313
    return Qnil;
319 314
}
320
-