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

ruby-changes:37824

From: nobu <ko1@a...>
Date: Mon, 9 Mar 2015 16:34:56 +0900 (JST)
Subject: [ruby-changes:37824] nobu:r49905 (trunk): stringio.c: don't raise after close

nobu	2015-03-09 16:34:39 +0900 (Mon, 09 Mar 2015)

  New Revision: 49905

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

  Log:
    stringio.c: don't raise after close
    
    * ext/stringio/stringio.c (strio_close): don't raise on dobule
      close for consistent to IO#close.

  Modified files:
    trunk/ChangeLog
    trunk/ext/stringio/stringio.c
    trunk/test/stringio/test_stringio.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49904)
+++ ChangeLog	(revision 49905)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  9 16:34:36 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/stringio/stringio.c (strio_close): don't raise on dobule
+	  close for consistent to IO#close.
+
 Mon Mar 09 06:44:48 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_insnhelper.h: define struct SVAR for SVAR.
Index: ext/stringio/stringio.c
===================================================================
--- ext/stringio/stringio.c	(revision 49904)
+++ ext/stringio/stringio.c	(revision 49905)
@@ -346,9 +346,6 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L346
 strio_close(VALUE self)
 {
     StringIO(self);
-    if (CLOSED(self)) {
-	rb_raise(rb_eIOError, "closed stream");
-    }
     RBASIC(self)->flags &= ~STRIO_READWRITE;
     return Qnil;
 }
Index: test/stringio/test_stringio.rb
===================================================================
--- test/stringio/test_stringio.rb	(revision 49904)
+++ test/stringio/test_stringio.rb	(revision 49905)
@@ -193,12 +193,12 @@ class TestStringIO < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/stringio/test_stringio.rb#L193
   def test_close
     f = StringIO.new("")
     f.close
-    assert_raise(IOError) { f.close }
+    assert_nil(f.close)
 
     f = StringIO.new("")
     f.close_read
     f.close_write
-    assert_raise(IOError) { f.close }
+    assert_nil(f.close)
   ensure
     f.close unless f.closed?
   end

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

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