From 93278f2387fb2f9fe8157dd3ba537f248c558e46 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 19 Dec 2009 00:58:13 +0000 Subject: [PATCH] * vm_eval.c (check_funcall): reset method_missing_reason before trying the call. based on a patch from Yehuda Katz in [ruby-core:27219]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ test/ruby/test_object.rb | 10 ++++++++++ vm_eval.c | 1 + 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 115746ba76..8245005bf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Dec 19 09:58:05 2009 Nobuyoshi Nakada + + * vm_eval.c (check_funcall): reset method_missing_reason before + trying the call. based on a patch from Yehuda Katz in + [ruby-core:27219]. + Sat Dec 19 09:29:22 2009 Marc-Andre Lafortune * lib/set.rb: Add checks that passed argument is Enumerable. diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 8352b03979..0a49422074 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -322,6 +322,16 @@ class TestObject < Test::Unit::TestCase assert_raise(ArgumentError) do c.new.method_missing end + + bug2494 = '[ruby-core:27219]' + c = Class.new do + def method_missing(meth, *args) + super + end + end + b = c.new + foo rescue nil + assert_nothing_raised(bug2494) {[b].flatten} end def test_respond_to_missing diff --git a/vm_eval.c b/vm_eval.c index f0b23168fc..4721de7c7d 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -275,6 +275,7 @@ check_funcall(VALUE recv, ID mid, int argc, VALUE *argv) else { struct rescue_funcall_args args; + th->method_missing_reason = 0; args.recv = recv; args.sym = ID2SYM(mid); args.argc = argc;