summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-29 12:50:38 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-29 12:50:38 +0000
commit6588ba877a54e42a3f5d27b44d7ee500fd868243 (patch)
treeff5b625f96feeaa6914d8f055f204de4fcf2c08f
parent335a9ef2f8acd966fd4f70281584e1c2258e4664 (diff)
merge revision(s) 42724: [Backport #8238]
* vm_insnhelper.c (vm_call_method): a method entry refers the based class/module, so should search superclass from the origin i-class where the entry belongs to, to get rid of infinite loop when zsuper in a prepended class/module. [ruby-core:54105] [Bug #8238] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--test/ruby/test_module.rb15
-rw-r--r--version.h6
-rw-r--r--vm_insnhelper.c9
4 files changed, 31 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 56d67dafcc..b24eef5254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Aug 29 21:28:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): a method entry refers the based
+ class/module, so should search superclass from the origin i-class
+ where the entry belongs to, to get rid of infinite loop when zsuper
+ in a prepended class/module. [ruby-core:54105] [Bug #8238]
+
Fri Aug 23 01:16:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 1239711756..915a1b9feb 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1525,6 +1525,21 @@ class TestModule < Test::Unit::TestCase
assert_nothing_raised(NoMethodError) {a.send :foo}
end
+ def test_prepend_visibility_inherited
+ bug8238 = '[ruby-core:54105] [Bug #8238]'
+ assert_separately [], <<-"end;", timeout: 3
+ class A
+ def foo() A; end
+ private :foo
+ end
+ class B < A
+ public :foo
+ prepend Module.new
+ end
+ assert_equal(A, B.new.foo, "#{bug8238}")
+ end;
+ end
+
def test_prepend_included_modules
bug8025 = '[ruby-core:53158] [Bug #8025]'
mixin = labeled_module("mixin")
diff --git a/version.h b/version.h
index 2e0e2f960a..5e5a28cfc3 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-08-23"
-#define RUBY_PATCHLEVEL 297
+#define RUBY_RELEASE_DATE "2013-08-29"
+#define RUBY_PATCHLEVEL 298
#define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 23
+#define RUBY_RELEASE_DAY 29
#include "ruby/version.h"
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 0a40a1e0dc..500b2b5594 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1739,6 +1739,8 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
start_method_dispatch:
if (ci->me != 0) {
if ((ci->me->flag == 0)) {
+ VALUE klass;
+
normal_method_dispatch:
switch (ci->me->def->type) {
case VM_METHOD_TYPE_ISEQ:{
@@ -1771,10 +1773,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
return vm_call_bmethod(th, cfp, ci);
}
case VM_METHOD_TYPE_ZSUPER:{
- VALUE klass;
-
+ klass = ci->me->klass;
+ klass = RCLASS_ORIGIN(klass);
zsuper_method_dispatch:
- klass = RCLASS_SUPER(ci->me->klass);
+ klass = RCLASS_SUPER(klass);
ci_temp = *ci;
ci = &ci_temp;
@@ -1836,6 +1838,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
goto normal_method_dispatch;
}
else {
+ klass = ci->me->klass;
goto zsuper_method_dispatch;
}
}