Skip to content

Commit f31a47f

Browse files
committed
merge revision(s) 41175: [Backport ruby#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
1 parent b41becd commit f31a47f

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Sun Jun 9 02:17:16 2013 Charlie Somerville <[email protected]>
2+
3+
* class.c (include_modules_at): invalidate method cache if included
4+
module contains constants
5+
6+
* test/ruby/test_module.rb: add test
7+
18
Sun Jun 9 01:59:39 2013 CHIKANAGA Tomoyuki <[email protected]>
29

310
merge revision 40783 (partially): [Backport #8413]

class.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module)
761761
}
762762
if (RMODULE_M_TBL(module) && RMODULE_M_TBL(module)->num_entries)
763763
changed = 1;
764+
if (RMODULE_CONST_TBL(module) && RMODULE_CONST_TBL(module)->num_entries)
765+
changed = 1;
764766
skip:
765767
module = RCLASS_SUPER(module);
766768
}

test/ruby/test_module.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,26 @@ def test_anonymous_module_public_class_method
17131713
assert_raise(NoMethodError, bug8284) {Object.define_method}
17141714
end
17151715

1716+
def test_include_module_with_constants_invalidates_method_cache
1717+
assert_in_out_err([], <<-RUBY, %w(123 456), [])
1718+
A = 123
1719+
1720+
class Foo
1721+
def self.a
1722+
A
1723+
end
1724+
end
1725+
1726+
module M
1727+
A = 456
1728+
end
1729+
1730+
puts Foo.a
1731+
Foo.send(:include, M)
1732+
puts Foo.a
1733+
RUBY
1734+
end
1735+
17161736
private
17171737

17181738
def assert_top_method_is_private(method)

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.0.0"
22
#define RUBY_RELEASE_DATE "2013-06-09"
3-
#define RUBY_PATCHLEVEL 212
3+
#define RUBY_PATCHLEVEL 213
44

55
#define RUBY_RELEASE_YEAR 2013
66
#define RUBY_RELEASE_MONTH 6

0 commit comments

Comments
 (0)