From 0580ba06110f7998fdaead724907a4c8d6540107 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 29 Oct 2009 04:55:10 +0000 Subject: * array.c (rb_ary_to_ary): do not use #respond_to? to detect to_ary. Just call. [ruby-core:23738] * eval.c (rb_check_funcall): new function with method existence check. returns Qundef when the method does not exist. * enumerator.c (enumerator_rewind): just call method, using rb_check_funcall(). [ruby-core:23738] * error.c (exc_equal): ditto. * object.c (convert_type): ditto. * error.c (rb_name_err_mesg_new): export function. * eval.c (make_exception): ditto. * io.c (pop_last_hash): return early when the last argument is nil. * io.c (rb_io_puts): treat T_STRING specially for small optimization. * vm_eval.c (raise_method_missing): skip method call if possible using rb_method_basic_definition_p(). * vm_eval.c (method_missing): ditto. * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test suites changed to ignore exceptions caused by just-call policy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index f04540417e..f150fb7617 100644 --- a/io.c +++ b/io.c @@ -5157,6 +5157,7 @@ pop_last_hash(int *argc_p, VALUE *argv) if (*argc_p == 0) return Qnil; last = argv[*argc_p-1]; + if (NIL_P(last)) return Qnil; tmp = rb_check_convert_type(last, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) return Qnil; @@ -6066,12 +6067,17 @@ rb_io_puts(int argc, VALUE *argv, VALUE out) return Qnil; } for (i=0; i