[Ruby 1.9-Bug#3973][Open] Unexpected error and segmentation fault without close

Bug #3973: Unexpected error and segmentation fault without close
http://redmine.ruby-lang.org/issues/show/3973

$B5/I<<T(B: Yoshimasa Niwa
$B%9%F!<%?%9(B: Open, $BM%@john(B: Normal
ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

Run next small code on ruby 1.9.2p0 shows unexpected TypeError on line
3.

while true
f = File.open(“/dev/null”, “w”)
f.write(“a”) # => in `': wrong argument type
#Class:0x0000010086dbb0 (expected Data) (TypeError)
end

This code doesn’t have “f.close” so it’s buggy, but it may not raise
TypeError.
Also, next code causes segmentation fault.

require ‘net/http’
while true
Net::HTTP.get(URI.parse(“http://localhost/”))
f = File.open(“/dev/null”, “w”)
f.write(“a”)
end

Ruby
1.9.2p0$B$G!“(Bclose$B$7K:$l$N(Bopen$B$,(Bwhile$B$NCf$K$”$k$H!“M=4|$7$J$$(BTypeError$B$,H/@8$7!”(B
$B$^$?>l9g$K$h$C$F$O(BSegmentation Fault$B$,H/@8$7$^$9!#(B

$B%A%1%C%H(B #3973 $B$,99?7$5$l$^$7$?!#(B (by Tomoyuki C.)

$B$9$_$^$;$s!“%A%1%C%H:n$C$?$i$H$9$9$a$?$N$O$o$?$7$J$N$G$9$,!”(B
$B$*$=$i$/(B http://redmine.ruby-lang.org/issues/show/3910
$B$HF10l$G$7$?!#(B