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

ruby-changes:24188

From: nobu <ko1@a...>
Date: Wed, 27 Jun 2012 22:40:47 +0900 (JST)
Subject: [ruby-changes:24188] nobu:r36239 (trunk): remove from original m_tbl

nobu	2012-06-27 22:40:37 +0900 (Wed, 27 Jun 2012)

  New Revision: 36239

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

  Log:
    remove from original m_tbl
    
    * vm_method.c (remove_method): remove the method from the original
      m_tbl on a prepended module.

  Modified files:
    trunk/test/ruby/test_module.rb
    trunk/vm_method.c

Index: vm_method.c
===================================================================
--- vm_method.c	(revision 36238)
+++ vm_method.c	(revision 36239)
@@ -452,6 +452,7 @@
     st_data_t key, data;
     rb_method_entry_t *me = 0;
 
+    klass = RCLASS_ORIGIN(klass);
     if (klass == rb_cObject) {
 	rb_secure(4);
     }
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 36238)
+++ test/ruby/test_module.rb	(revision 36239)
@@ -1290,4 +1290,13 @@
     o.singleton_class.class_eval {prepend Module.new}
     assert_equal([], o.singleton_methods)
   end
+
+  def test_prepend_remove_method
+    assert_raise(NameError) do
+      Class.new do
+        prepend Module.new {def foo; end}
+        remove_method(:foo)
+      end
+    end
+  end
 end

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

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