[前][次][番号順一覧][スレッド一覧]

ruby-changes:39346

From: nobu <ko1@a...>
Date: Wed, 29 Jul 2015 15:25:38 +0900 (JST)
Subject: [ruby-changes:39346] nobu:r51427 (trunk): vm_eval.c: set method_missing_reason

nobu	2015-07-29 15:25:21 +0900 (Wed, 29 Jul 2015)

  New Revision: 51427

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51427

  Log:
    vm_eval.c: set method_missing_reason
    
    * vm_eval.c (send_internal): set method_missing_reason before
      invoking overriding method_missing method so that the default
      method_missing can achieve it properly.
      [ruby-core:68515] [Bug #10969]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_exception.rb
    trunk/vm_eval.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51426)
+++ ChangeLog	(revision 51427)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul 29 15:25:19 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_eval.c (send_internal): set method_missing_reason before
+	  invoking overriding method_missing method so that the default
+	  method_missing can achieve it properly.
+	  [ruby-core:68515] [Bug #10969]
+
 Wed Jul 29 14:54:16 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* hash.c (rb_sym_hash): return same value as rb_any_hash() of
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 51426)
+++ vm_eval.c	(revision 51427)
@@ -913,6 +913,7 @@ send_internal(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L913
 	    }
 	}
 	id = idMethodMissing;
+	th->method_missing_reason = MISSING_NOENTRY;
     }
     else {
 	argv++; argc--;
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 51426)
+++ test/ruby/test_exception.rb	(revision 51427)
@@ -704,4 +704,11 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L704
       raise E
     end;
   end
+
+  def test_method_missing_reason_clear
+    bug10969 = '[ruby-core:68515] [Bug #10969]'
+    a = Class.new {def method_missing(*) super end}.new
+    assert_raise(NameError) {a.instance_eval("foo")}
+    assert_raise(NoMethodError, bug10969) {a.public_send("bar", true)}
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]