summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:59:42 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:59:42 +0000
commit639eff2ea7738cbaca771a8fb8e2e20dde1585e3 (patch)
tree57dd0b29d534329d5d6195eb7077813ba58eae2a
parentedf505a7e8d52970a2a1ae29ab450abf3819a63b (diff)
merge revision(s) 56520: [Backport #12876]
* vm_eval.c (vm_call0_body): follow the original class, not to loop the prepended module. [ruby-core:77784] [Bug #12876] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_super.rb14
-rw-r--r--version.h2
-rw-r--r--vm_eval.c2
4 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f29d05ac7f..e14efd6e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 15 02:49:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (vm_call0_body): follow the original class, not to
+ loop the prepended module. [ruby-core:77784] [Bug #12876]
+
Tue Nov 15 02:45:44 2016 NARUSE, Yui <naruse@ruby-lang.org>
* lib/net/http.rb (transport_request): other than HTTPContinue
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 06e3e6e3b5..2764cf534b 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -530,4 +530,18 @@ class TestSuper < Test::Unit::TestCase
assert_equal "b", b.new.foo{"c"}
end
+
+ def test_public_zsuper_with_prepend
+ bug12876 = '[ruby-core:77784] [Bug #12876]'
+ m = EnvUtil.labeled_module("M")
+ c = EnvUtil.labeled_class("C") {prepend m; public :initialize}
+ o = assert_nothing_raised(Timeout::Error, bug12876) {
+ Timeout.timeout(3) {c.new}
+ }
+ assert_instance_of(c, o)
+ m.module_eval {def initialize; raise "exception in M"; end}
+ assert_raise_with_message(RuntimeError, "exception in M") {
+ c.new
+ }
+ end
end
diff --git a/version.h b/version.h
index 633c3688c7..a471486454 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-11-15"
-#define RUBY_PATCHLEVEL 214
+#define RUBY_PATCHLEVEL 215
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 11
diff --git a/vm_eval.c b/vm_eval.c
index ce95106fbb..57e6393610 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -207,7 +207,7 @@ vm_call0_body(rb_thread_t* th, struct rb_calling_info *calling, const struct rb_
goto again;
}
- super_class = RCLASS_SUPER(cc->me->defined_class);
+ super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class));
if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) {
enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;