зеркало из https://github.com/github/ruby.git
Fix the placeholder subclass entry skipping [Bug #18489]
This commit is contained in:
Родитель
e53962b9e1
Коммит
f3c77bd480
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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче