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

ruby-changes:41967

From: nagachika <ko1@a...>
Date: Wed, 9 Mar 2016 04:12:28 +0900 (JST)
Subject: [ruby-changes:41967] nagachika:r54041 (ruby_2_2): merge revision(s) 53329: [Backport #11885]

nagachika	2016-03-09 04:12:23 +0900 (Wed, 09 Mar 2016)

  New Revision: 54041

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54041

  Log:
    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]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/io.c
    branches/ruby_2_2/test/ruby/test_io.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 54040)
+++ ruby_2_2/version.h	(revision 54041)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #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
Index: ruby_2_2/test/ruby/test_io.rb
===================================================================
--- ruby_2_2/test/ruby/test_io.rb	(revision 54040)
+++ ruby_2_2/test/ruby/test_io.rb	(revision 54041)
@@ -3152,6 +3152,17 @@ End https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_io.rb#L3152
     }
   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]'
 
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 54040)
+++ ruby_2_2/ChangeLog	(revision 54041)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed Mar  9 04:05:36 2016  Eric Wong  <e@8...>
+
+	* 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@d...>
 
 	* compile.c, cont.c, doc, man: fix common misspelling.
Index: ruby_2_2/io.c
===================================================================
--- ruby_2_2/io.c	(revision 54040)
+++ ruby_2_2/io.c	(revision 54041)
@@ -2483,7 +2483,7 @@ io_getpartial(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_2/io.c#L2483
     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, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/io.c#L2675
 
     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);
 

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53329


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

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