summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-08 17:24:54 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-08 17:24:54 +0000
commitf31a47fdae9cad888847852c847963f6e22f22ba (patch)
tree372132a5a7f659188f5c826fa2988df9766c9994
parentb41becd2f0805cb345d793a54e681a426d98d9d0 (diff)
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--class.c2
-rw-r--r--test/ruby/test_module.rb20
-rw-r--r--version.h2
4 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a1bbb3dfa..ce404fde14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Jun 9 02:17:16 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * 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@ruby-lang.org>
merge revision 40783 (partially): [Backport #8413]
diff --git a/class.c b/class.c
index f9f5dd84c2..25e732ac2e 100644
--- a/class.c
+++ b/class.c
@@ -761,6 +761,8 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module)
}
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);
}
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 0b47367d66..9db30ee39c 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1713,6 +1713,26 @@ class TestModule < Test::Unit::TestCase
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)
diff --git a/version.h b/version.h
index 3174a080e4..af8cd66101 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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