Revision: 5250 http://trac.macosforge.org/projects/ruby/changeset/5250 Author: watson1978@gmail.com Date: 2011-03-03 23:40:56 -0800 (Thu, 03 Mar 2011) Log Message: ----------- IO#try_convert will raise TypeError if the object does not return an IO from #to_io. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions obj = Object.new def obj.to_io 'foo' end assert_raise(TypeError){ IO.try_convert(obj) } puts :ok }}} Modified Paths: -------------- MacRuby/trunk/io.c Modified: MacRuby/trunk/io.c =================================================================== --- MacRuby/trunk/io.c 2011-03-04 07:40:52 UTC (rev 5249) +++ MacRuby/trunk/io.c 2011-03-04 07:40:56 UTC (rev 5250) @@ -3597,9 +3597,7 @@ static VALUE rb_io_s_try_convert(VALUE dummy, SEL sel, VALUE obj) { - return rb_respond_to(obj, rb_intern("to_io")) - ? rb_funcall3(obj, rb_intern("to_io"), 0, 0) - : Qnil; + return rb_io_check_io(obj); } /*
participants (1)
-
source_changes@macosforge.org