Bug #14338
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
"`ruby ``` "ruby -e STDOUT.write`" STDOUT.write" outputs "`#<IO:0x583a2de0>`" "#<IO:0x583a2de0>" (without quotes) "`ruby "ruby -rstringio -e 'p StringIO.new.write'`" StringIO.new.write'" shows zero bytes written The following restores <= 2.4 behavior for `IO#write`, IO#write, but other things (StringIO, OpenSSL, ...) need to be modified, too: ```diff diff --git a/io.c b/io.c index eeaf0c021c..0d95d12a9b 100644 --- a/io.c +++ b/io.c @@ -1675,7 +1675,10 @@ io_writev(int argc, VALUE *argv, VALUE io) static VALUE io_write_m(int argc, VALUE *argv, VALUE io) { - if (argc > 1) { + if (argc <= 0) { + rb_error_arity(argc, 1, UNLIMITED_ARGUMENTS); + } + else if (argc > 1) { return io_writev(argc, argv, io); } else { ``` Opinions? Should we raise or just return 0 when no args are given? ```