summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2022-01-31 18:15:30 +0900
committerNARUSE, Yui <naruse@airemix.jp>2022-01-31 18:15:30 +0900
commit629b9da7dbdcaff04d6dde70f2431396f66e03e5 (patch)
tree05186bb858e6afc3d45c4c5f6087d8deeced6913
parent5b0c7b4ad00cd2ada282ea1aa03f0c1a75b0df77 (diff)
merge revision(s) f3c77bd480834f2835fe6fef5c0475336248dbde: [Backport #18489]
Fix the placeholder subclass entry skipping [Bug #18489] --- class.c | 3 +-- test/ruby/test_module.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
-rw-r--r--class.c3
-rw-r--r--test/ruby/test_module.rb9
-rw-r--r--version.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/class.c b/class.c
index 5d3d46d1e6..65a989f9d7 100644
--- a/class.c
+++ b/class.c
@@ -1053,8 +1053,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;
}
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index b84a090fce..fa890c0e40 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -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
diff --git a/version.h b/version.h
index 7af99cc04a..06df6ce639 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 8
+#define RUBY_PATCHLEVEL 9
#define RUBY_RELEASE_YEAR 2022
#define RUBY_RELEASE_MONTH 1