ruby-changes:47035
From: glass <ko1@a...>
Date: Fri, 23 Jun 2017 13:20:00 +0900 (JST)
Subject: [ruby-changes:47035] glass:r59150 (trunk): Revert "Allow IO#reopen to take a block"
glass 2017-06-23 13:19:53 +0900 (Fri, 23 Jun 2017) New Revision: 59150 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59150 Log: Revert "Allow IO#reopen to take a block" This reverts r59142. Modified files: trunk/NEWS trunk/io.c trunk/test/ruby/test_io.rb Index: io.c =================================================================== --- io.c (revision 59149) +++ io.c (revision 59150) @@ -7058,10 +7058,6 @@ rb_io_reopen(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/io.c#L7058 } } - if (rb_block_given_p()) { - return rb_ensure(rb_yield, file, io_close, file); - } - return file; } Index: NEWS =================================================================== --- NEWS (revision 59149) +++ NEWS (revision 59150) @@ -44,7 +44,6 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L44 * IO#pread [Feature #4532] * IO#pwrite [Feature #4532] - * IO#reopen takes a block [Feature #2631] * IOError Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 59149) +++ test/ruby/test_io.rb (revision 59150) @@ -2156,22 +2156,6 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2156 } end - def test_reopen_with_block - make_tempfile {|t| - open(__FILE__) do |f| - f.gets - assert_nothing_raised { - reopened = nil - f.reopen(t.path) do |_reopened| - reopened = _reopened - assert_equal("foo\n", reopened.gets) - end - assert_equal(true, reopened.closed?) - } - end - } - end - def test_reopen_inherit mkcdtmpdir { system(EnvUtil.rubybin, '-e', <<"End") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/