From be21eb5d0f362bd9ec2922b590c84b7e87592a6c Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 28 Nov 2009 00:26:27 +0000 Subject: [PATCH] * vm_eval.c (check_funcall_failed): should rescue user raised NoMethodError. rescue all NoMethodError if receiver does not respond to the method name. [ruby-dev:39796] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ vm_eval.c | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68ba3a8416..c613855f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Nov 28 09:05:53 2009 Yukihiro Matsumoto + + * vm_eval.c (check_funcall_failed): should rescue user raised + NoMethodError. rescue all NoMethodError if receiver does not + respond to the method name. [ruby-dev:39796] + Thu Nov 26 21:14:30 2009 Yuki Sonoda (Yugui) * test/ruby/test_complex.rb (@unify): fix the detection if math diff --git a/vm_eval.c b/vm_eval.c index 8d1054c8af..18cc8361d3 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -255,10 +255,9 @@ check_funcall_exec(struct rescue_funcall_args *args) static VALUE check_funcall_failed(struct rescue_funcall_args *args, VALUE e) { - VALUE sym = rb_funcall(e, rb_intern("name"), 0, 0); - - if (args->sym != sym) + if (rb_respond_to(args->recv, args->sym)) { rb_exc_raise(e); + } return Qundef; }