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

ruby-changes:18050

From: nobu <ko1@a...>
Date: Fri, 3 Dec 2010 22:47:01 +0900 (JST)
Subject: [ruby-changes:18050] Ruby:r30071 (trunk): * vm_insnhelper.c (vm_call_method): protected methods should be

nobu	2010-12-03 22:36:49 +0900 (Fri, 03 Dec 2010)

  New Revision: 30071

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

  Log:
    * vm_insnhelper.c (vm_call_method): protected methods should be
      checked against the real class.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_method.rb
    trunk/vm_insnhelper.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30070)
+++ ChangeLog	(revision 30071)
@@ -1,3 +1,8 @@
+Fri Dec  3 22:36:45 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_insnhelper.c (vm_call_method): protected methods should be
+	  checked against the real class.
+
 Fri Dec  3 20:23:31 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (convertible_int): define printf format prefix too.
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 30070)
+++ vm_insnhelper.c	(revision 30071)
@@ -629,13 +629,7 @@
 	    else if (!(flag & VM_CALL_OPT_SEND_BIT) && (me->flag & NOEX_MASK) & NOEX_PROTECTED) {
 		VALUE defined_class = me->klass;
 
-		if (FL_TEST(defined_class, FL_SINGLETON)) {
-		    defined_class = RCLASS_SUPER(defined_class);
-		}
-		else if (RB_TYPE_P(defined_class, T_ICLASS)) {
-		    defined_class = RBASIC(defined_class)->klass;
-		}
-
+		defined_class = rb_class_real(defined_class);
 		if (!rb_obj_is_kind_of(cfp->self, defined_class)) {
 		    val = vm_method_missing(th, id, recv, num, blockptr, NOEX_PROTECTED);
 		}
Index: test/ruby/test_method.rb
===================================================================
--- test/ruby/test_method.rb	(revision 30070)
+++ test/ruby/test_method.rb	(revision 30071)
@@ -420,6 +420,8 @@
       end
       def test
         a = dup
+        a.extend(Module.new)
+        a.extend(Module.new)
         class << a
           protected :meth
         end

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

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