summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-08 19:12:23 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-08 19:12:23 +0000
commit117fec74396341a72956bb0e3c5ed8c87614f7e5 (patch)
tree019fac0555e765c2084e58389d8f656f540058ac
parent0df86c0b0a47f566d6f5abada2af64d91dcb34fe (diff)
merge revision(s) 53329: [Backport #11885]
* io.c (io_getpartial): remove unused kwarg from template * test/ruby/test_io.rb (test_readpartial_bad_args): new [Bug #11885] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--io.c6
-rw-r--r--test/ruby/test_io.rb11
-rw-r--r--version.h2
4 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1426a7de71..ab2bfafe4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Mar 9 04:05:36 2016 Eric Wong <e@80x24.org>
+
+ * io.c (io_getpartial): remove unused kwarg from template
+ * test/ruby/test_io.rb (test_readpartial_bad_args): new
+ [Bug #11885]
+
Wed Mar 9 03:53:37 2016 Tadashi Saito <tadashi_saito@dwango.co.jp>
* compile.c, cont.c, doc, man: fix common misspelling.
diff --git a/io.c b/io.c
index 33b389b82e..081aefff24 100644
--- a/io.c
+++ b/io.c
@@ -2483,7 +2483,7 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock, int no_exception)
long n, len;
struct read_internal_arg arg;
- rb_scan_args(argc, argv, "11:", &length, &str, NULL);
+ rb_scan_args(argc, argv, "11", &length, &str);
if ((len = NUM2LONG(length)) < 0) {
rb_raise(rb_eArgError, "negative length %ld given", len);
@@ -2675,8 +2675,10 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io)
rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
- if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts))
+ if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts)) {
no_exception = 1;
+ argc--;
+ }
ret = io_getpartial(argc, argv, io, 1, no_exception);
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 96c9ebc1eb..0f994a14bb 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3152,6 +3152,17 @@ End
}
end
+ def test_readpartial_bad_args
+ IO.pipe do |r, w|
+ w.write '.'
+ buf = String.new
+ assert_raise(ArgumentError) { r.readpartial(1, buf, exception: false) }
+ assert_raise(TypeError) { r.readpartial(1, exception: false) }
+ assert_equal [[r],[],[]], IO.select([r], nil, nil, 1)
+ assert_equal '.', r.readpartial(1)
+ end
+ end
+
def test_sysread_unlocktmp_ensure
bug8669 = '[ruby-core:56121] [Bug #8669]'
diff --git a/version.h b/version.h
index 6290081d30..a796de7d44 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.5"
#define RUBY_RELEASE_DATE "2016-03-09"
-#define RUBY_PATCHLEVEL 245
+#define RUBY_PATCHLEVEL 246
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3