Bug #4225
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
=begin It looks like the `IO.foreach` IO.foreach method doesn't check its argument type first if no block is provided: ~~~ruby fh = File.new('somefile.txt') IO.foreach(fh.fileno) # Or, IO.foreach(999999999) => #<Enumerable::Enumerator:0x110b0d4> IO.foreach(fh.fileno){ |line| p line } TypeError: can't convert Fixnum into String ~~~ I'd flip these two lines in io.c: ~~~C RETURN_ENUMERATOR(self, argc, argv); SafeStringValue(fname); ~~~ Otherwise, what am I enumerating? =end