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

ruby-changes:29140

From: nagachika <ko1@a...>
Date: Sun, 9 Jun 2013 02:25:53 +0900 (JST)
Subject: [ruby-changes:29140] nagachika:r41192 (ruby_2_0_0): merge revision(s) 41175: [Backport #8502]

nagachika	2013-06-09 02:24:54 +0900 (Sun, 09 Jun 2013)

  New Revision: 41192

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

  Log:
    merge revision(s) 41175: [Backport #8502]
    
    * class.c (include_modules_at): invalidate method cache if included
      module contains constants
    
    * test/ruby/test_module.rb: add test

  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_module.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41191)
+++ ruby_2_0_0/ChangeLog	(revision 41192)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sun Jun  9 02:17:16 2013  Charlie Somerville  <charliesome@r...>
+
+	* class.c (include_modules_at): invalidate method cache if included
+	  module contains constants
+
+	* test/ruby/test_module.rb: add test
+
 Sun Jun  9 01:59:39 2013  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 merge revision 40783 (partially): [Backport #8413]
Index: ruby_2_0_0/class.c
===================================================================
--- ruby_2_0_0/class.c	(revision 41191)
+++ ruby_2_0_0/class.c	(revision 41192)
@@ -761,6 +761,8 @@ include_modules_at(const VALUE klass, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/class.c#L761
 	}
 	if (RMODULE_M_TBL(module) && RMODULE_M_TBL(module)->num_entries)
 	    changed = 1;
+	if (RMODULE_CONST_TBL(module) && RMODULE_CONST_TBL(module)->num_entries)
+	    changed = 1;
       skip:
 	module = RCLASS_SUPER(module);
     }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41191)
+++ ruby_2_0_0/version.h	(revision 41192)
@@ -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-06-09"
-#define RUBY_PATCHLEVEL 212
+#define RUBY_PATCHLEVEL 213
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_0_0/test/ruby/test_module.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_module.rb	(revision 41191)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 41192)
@@ -1713,6 +1713,26 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1713
     assert_raise(NoMethodError, bug8284) {Object.define_method}
   end
 
+  def test_include_module_with_constants_invalidates_method_cache
+    assert_in_out_err([], <<-RUBY, %w(123 456), [])
+      A = 123
+
+      class Foo
+        def self.a
+          A
+        end
+      end
+
+      module M
+        A = 456
+      end
+
+      puts Foo.a
+      Foo.send(:include, M)
+      puts Foo.a
+    RUBY
+  end
+
   private
 
   def assert_top_method_is_private(method)

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


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

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