Fix the placeholder subclass entry skipping [Bug #18489]
This commit is contained in:
parent
e53962b9e1
commit
f3c77bd480
Notes:
git
2022-01-17 21:23:59 +09:00
3
class.c
3
class.c
@ -1054,8 +1054,7 @@ rb_include_module(VALUE klass, VALUE module)
|
||||
if (RB_TYPE_P(klass, T_MODULE)) {
|
||||
rb_subclass_entry_t *iclass = RCLASS_SUBCLASSES(klass);
|
||||
// skip the placeholder subclass entry at the head of the list
|
||||
if (iclass && iclass->next) {
|
||||
RUBY_ASSERT(!iclass->klass);
|
||||
if (iclass && !iclass->klass) {
|
||||
iclass = iclass->next;
|
||||
}
|
||||
|
||||
|
@ -475,6 +475,15 @@ class TestModule < Test::Unit::TestCase
|
||||
assert_not_include(mod.ancestor_list, BasicObject)
|
||||
end
|
||||
|
||||
def test_module_collected_extended_object
|
||||
m1 = labeled_module("m1")
|
||||
m2 = labeled_module("m2")
|
||||
Object.new.extend(m1)
|
||||
GC.start
|
||||
m1.include(m2)
|
||||
assert_equal([m1, m2], m1.ancestors)
|
||||
end
|
||||
|
||||
def test_dup
|
||||
OtherSetup.call
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user