Project

General

Profile

Actions

Bug #2516

closed

IO#reopen Compatibility (original: [ruby-dev:39479])

Added by ujihisa (Tatsuhiro Ujihisa) over 14 years ago. Updated almost 13 years ago.

Status:
Rejected
Target version:
ruby -v:
ruby 1.9.2dev (2009-12-22 trunk 26152) [i386-darwin9.8.0]
Backport:

Description

=begin
takkanmさんとなかださんの[ruby-dev:39479]のスレッドによると、IO#reopenのnilの問題は解決したものの、いつのまにか挙動が変更されていたとのことです。
この変更は意図的なものなのか意図していないものなのかどちらなのでしょう。

 % cat test.rb
 f1 = File.open "file1.txt"
 f2 = File.open "file2.txt"
 f1.reopen f2
 puts f1.gets
 puts f1.gets
 puts(f1.reopen(f2).gets)
 % ruby -v
 ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
 % ruby test.rb
 Line 1
 Line 2
 Line 1
 % ruby -v
 ruby 1.9.2dev (2009-10-17 trunk 25387) [i386-darwin9.8.0]
 % ruby test.rb
 Line 1
 Line 2
 Line 3

このissueは #1755 にも関連しています。
http://redmine.ruby-lang.org/issues/show/1755

意図したものならば、この変更をRubySpecにも反映させます。

個人的には現状の挙動が嬉しいです。

=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #2700: various behavior when reopening File twiceRejectednobu (Nobuyoshi Nakada)Actions
Related to Ruby master - Bug #2747: io.dup doesn't handle pos properlyRejected02/15/2010Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0