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

ruby-changes:29593

From: usa <ko1@a...>
Date: Wed, 26 Jun 2013 16:27:04 +0900 (JST)
Subject: [ruby-changes:29593] usa:r41645 (ruby_1_9_3): merge revision(s) 41175: [Backport #8503]

usa	2013-06-26 16:26:49 +0900 (Wed, 26 Jun 2013)

  New Revision: 41645

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

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

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/class.c
    branches/ruby_1_9_3/test/ruby/test_module.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 41644)
+++ ruby_1_9_3/ChangeLog	(revision 41645)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Wed Jun 26 16:22:12 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
+
 Wed Jun 26 16:13:25 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (io_getc): fix 7bit coderange condition, check if ascii read
Index: ruby_1_9_3/class.c
===================================================================
--- ruby_1_9_3/class.c	(revision 41644)
+++ ruby_1_9_3/class.c	(revision 41645)
@@ -699,6 +699,8 @@ rb_include_module(VALUE klass, VALUE mod https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/class.c#L699
 	c = RCLASS_SUPER(c) = include_class_new(module, RCLASS_SUPER(c));
 	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_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 41644)
+++ ruby_1_9_3/version.h	(revision 41645)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 437
+#define RUBY_PATCHLEVEL 438
 
 #define RUBY_RELEASE_DATE "2013-06-26"
 #define RUBY_RELEASE_YEAR 2013
Index: ruby_1_9_3/test/ruby/test_module.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_module.rb	(revision 41644)
+++ ruby_1_9_3/test/ruby/test_module.rb	(revision 41645)
@@ -1220,4 +1220,24 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_module.rb#L1220
     INPUT
     assert_in_out_err([], src, ["NameError"], [])
   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
 end

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


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

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