[前][次][番号順一覧][スレッド一覧]

ruby-changes:60170

From: Nobuyoshi <ko1@a...>
Date: Sun, 23 Feb 2020 16:48:59 +0900 (JST)
Subject: [ruby-changes:60170] 588a86e32c (master): Warn non-nil `$, ` in `IO#print` too

https://git.ruby-lang.org/ruby.git/commit/?id=588a86e32c

From 588a86e32c9e646823e1436e53ffe1c37206abd3 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 20 Jan 2020 17:28:56 +0900
Subject: Warn non-nil `$,` in `IO#print` too


diff --git a/io.c b/io.c
index 19fe51b..b3175df 100644
--- a/io.c
+++ b/io.c
@@ -7615,6 +7615,9 @@ rb_io_print(int argc, const VALUE *argv, VALUE out) https://github.com/ruby/ruby/blob/trunk/io.c#L7615
 	line = rb_lastline_get();
 	argv = &line;
     }
+    if (argc > 1 && !NIL_P(rb_output_fs)) {
+        rb_warn("$, is set to non-nil value");
+    }
     for (i=0; i<argc; i++) {
 	if (!NIL_P(rb_output_fs) && i>0) {
 	    rb_io_write(out, rb_output_fs);
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 6bdc7bb..af2b08d 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2572,7 +2572,7 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2572
     $\ = "\n"
     pipe(proc do |w|
       w.print('a')
-      w.print('a','b','c')
+      EnvUtil.suppress_warning {w.print('a','b','c')}
       w.close
     end, proc do |r|
       assert_equal("a\n", r.gets)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]