summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--class.c2
-rw-r--r--test/ruby/test_module.rb12
-rw-r--r--version.h2
3 files changed, 14 insertions, 2 deletions
diff --git a/class.c b/class.c
index 0fd4029f4c..b2a219100c 100644
--- a/class.c
+++ b/class.c
@@ -1194,8 +1194,8 @@ rb_include_module(VALUE klass, VALUE module)
iclass = iclass->next;
}
- int do_include = 1;
while (iclass) {
+ int do_include = 1;
VALUE check_class = iclass->klass;
/* During lazy sweeping, iclass->klass could be a dead object that
* has not yet been swept. */
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 4722fa22e0..29b71bc027 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -784,6 +784,18 @@ class TestModule < Test::Unit::TestCase
assert_equal([:m1, :m0, :m, :sc, :m1, :m0, :c], sc.new.m)
end
+ def test_include_into_module_after_prepend_bug_20871
+ bar = Module.new{def bar; 'bar'; end}
+ foo = Module.new{def foo; 'foo'; end}
+ m = Module.new
+ c = Class.new{include m}
+ m.prepend bar
+ Class.new{include m}
+ m.include foo
+ assert_include c.ancestors, foo
+ assert_equal "foo", c.new.foo
+ end
+
def test_protected_include_into_included_module
m1 = Module.new do
def other_foo(other)
diff --git a/version.h b/version.h
index da4638009a..29f2fcfdf2 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 112
+#define RUBY_PATCHLEVEL 113
#include "ruby/version.h"
#include "ruby/internal/abi.h"