From: Mauricio Fernandez Date: 2005-12-16T18:40:18+09:00 Subject: Re: [PATCH] Re: IO.open not calling close in block form? On Fri, Dec 16, 2005 at 12:12:15PM +0900, nobuyoshi nakada wrote: > Hi, > > At Fri, 16 Dec 2005 10:45:35 +0900, > Mauricio Fernandez wrote in [ruby-core:06912]: > > What about this? > > It won't work fine if closed? method is overridden. ? $ ./ruby -ve 'open("/dev/null") {|f| def f.close; $stdout.puts "closed"; end; def f.closed?; false end; raise ArgumentError }' ruby 1.8.4 (2005-11-02) [i686-linux] closed -e:1: ArgumentError (ArgumentError) from -e:1 $ ./ruby -ve 'open("/dev/null") {|f| def f.close; $stdout.puts "closed"; end; def f.closed?; false end; }' ruby 1.8.4 (2005-11-02) [i686-linux] closed if (!RTEST(rb_io_closed(io))) bypasses normal dispatching, doesn't it? -- Mauricio Fernandez