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

ruby-changes:70643

From: Samuel <ko1@a...>
Date: Wed, 29 Dec 2021 09:28:17 +0900 (JST)
Subject: [ruby-changes:70643] f27eb8148f (master): Sync io-console gem.

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

From f27eb8148f5a72bbacfebfecc7de9305471bb5c9 Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Wed, 29 Dec 2021 13:27:40 +1300
Subject: Sync io-console gem.

---
 ext/io/console/console.c           | 8 ++++++--
 test/io/console/test_io_console.rb | 8 ++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 4c5f89f80df..4ec24178c4a 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -90,6 +90,10 @@ extern VALUE rb_scheduler_timeout(struct timeval *timeout); https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L90
 #define sys_fail_fptr(fptr) rb_sys_fail_str((fptr)->pathv)
 
 #ifndef HAVE_RB_F_SEND
+#ifndef RB_PASS_CALLED_KEYWORDS
+# define rb_funcallv_kw(recv, mid, arg, argv, kw_splat) rb_funcallv(recv, mid, arg, argv)
+#endif
+
 static ID id___send__;
 
 static VALUE
@@ -104,7 +108,7 @@ rb_f_send(int argc, VALUE *argv, VALUE recv) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L108
     else {
 	vid = id___send__;
     }
-    return rb_funcallv(recv, vid, argc, argv);
+    return rb_funcallv_kw(recv, vid, argc, argv, RB_PASS_CALLED_KEYWORDS);
 }
 #endif
 
@@ -555,7 +559,7 @@ console_getch(int argc, VALUE *argv, VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L559
 	    if (w < 0) rb_eof_error();
 	    if (!(w & RB_WAITFD_IN)) return Qnil;
 # else
-	    VALUE result = rb_io_wait(io, RUBY_IO_READABLE, timeout);
+	    VALUE result = rb_io_wait(io, RB_INT2NUM(RUBY_IO_READABLE), timeout);
 	    if (!RTEST(result)) return Qnil;
 # endif
 	}
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 33b98990a14..ac75df7f0c3 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -407,6 +407,10 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L407
       assert_equal(["true"], run_pty("IO.console(:close); p IO.console(:tty?)"))
     end
 
+    def test_console_kw
+      assert_equal(["File"], run_pty("IO.console.close; p IO.console(:clone, freeze: true).class"))
+    end
+
     def test_sync
       assert_equal(["true"], run_pty("p IO.console.sync"))
     end
@@ -483,6 +487,10 @@ defined?(IO.console) and TestIO_Console.class_eval do https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L487
       IO.console(:close)
     end
 
+    def test_console_kw
+      assert_kind_of(IO, IO.console(:clone, freeze: true))
+    end
+
     def test_sync
       assert(IO.console.sync, "console should be unbuffered")
     ensure
-- 
cgit v1.2.1


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

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