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

ruby-changes:30845

From: nagachika <ko1@a...>
Date: Fri, 13 Sep 2013 01:08:38 +0900 (JST)
Subject: [ruby-changes:30845] nagachika:r42924 (ruby_2_0_0): merge revision(s) 42903: [Backport #8881]

nagachika	2013-09-13 01:08:31 +0900 (Fri, 13 Sep 2013)

  New Revision: 42924

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

  Log:
    merge revision(s) 42903: [Backport #8881]
    
    * class.c (method_entry_i): should exclude refined methods from
      instance method list.  [ruby-core:57080] [Bug #8881]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/class.c
    branches/ruby_2_0_0/test/ruby/test_refinement.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 42923)
+++ ruby_2_0_0/ChangeLog	(revision 42924)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Sep 13 00:57:54 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* class.c (method_entry_i): should exclude refined methods from
+	  instance method list.  [ruby-core:57080] [Bug #8881]
+
 Fri Sep 13 00:33:09 2013  Charlie Somerville  <charliesome@r...>
 
 	* vm_eval.c (vm_call0): fix prototype, the id parameter should be of
Index: ruby_2_0_0/class.c
===================================================================
--- ruby_2_0_0/class.c	(revision 42923)
+++ ruby_2_0_0/class.c	(revision 42924)
@@ -989,6 +989,10 @@ method_entry_i(st_data_t key, st_data_t https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/class.c#L989
     st_table *list = (st_table *)data;
     long type;
 
+    if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
+	me = rb_resolve_refined_method(Qnil, me, NULL);
+	if (!me) return ST_CONTINUE;
+    }
     if (!st_lookup(list, key, 0)) {
 	if (UNDEFINED_METHOD_ENTRY_P(me)) {
 	    type = -1; /* none */
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42923)
+++ ruby_2_0_0/version.h	(revision 42924)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-09-13"
-#define RUBY_PATCHLEVEL 306
+#define RUBY_PATCHLEVEL 307
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/ruby/test_refinement.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_refinement.rb	(revision 42923)
+++ ruby_2_0_0/test/ruby/test_refinement.rb	(revision 42924)
@@ -847,6 +847,17 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_refinement.rb#L847
     RUBY
   end
 
+  def test_instance_methods
+    bug8881 = '[ruby-core:57080] [Bug #8881]'
+    assert_not_include(Foo.instance_methods(false), :z, bug8881)
+    assert_not_include(FooSub.instance_methods(true), :z, bug8881)
+  end
+
+  def test_method_defined
+    assert_not_send([Foo, :method_defined?, :z])
+    assert_not_send([FooSub, :method_defined?, :z])
+  end
+
   private
 
   def eval_using(mod, s)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r42903


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

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