stringio.c: don't raise after close
* ext/stringio/stringio.c (strio_close): don't raise on dobule close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c87e39165
commit
2e02f2dfd2
@ -1,3 +1,8 @@
|
|||||||
|
Mon Mar 9 16:34:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@atdot.net>
|
Mon Mar 09 06:44:48 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_insnhelper.h: define struct SVAR for SVAR.
|
* vm_insnhelper.h: define struct SVAR for SVAR.
|
||||||
|
@ -346,9 +346,6 @@ static VALUE
|
|||||||
strio_close(VALUE self)
|
strio_close(VALUE self)
|
||||||
{
|
{
|
||||||
StringIO(self);
|
StringIO(self);
|
||||||
if (CLOSED(self)) {
|
|
||||||
rb_raise(rb_eIOError, "closed stream");
|
|
||||||
}
|
|
||||||
RBASIC(self)->flags &= ~STRIO_READWRITE;
|
RBASIC(self)->flags &= ~STRIO_READWRITE;
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
@ -193,12 +193,12 @@ class TestStringIO < Test::Unit::TestCase
|
|||||||
def test_close
|
def test_close
|
||||||
f = StringIO.new("")
|
f = StringIO.new("")
|
||||||
f.close
|
f.close
|
||||||
assert_raise(IOError) { f.close }
|
assert_nil(f.close)
|
||||||
|
|
||||||
f = StringIO.new("")
|
f = StringIO.new("")
|
||||||
f.close_read
|
f.close_read
|
||||||
f.close_write
|
f.close_write
|
||||||
assert_raise(IOError) { f.close }
|
assert_nil(f.close)
|
||||||
ensure
|
ensure
|
||||||
f.close unless f.closed?
|
f.close unless f.closed?
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user