ruby-changes:30647
From: nagachika <ko1@a...>
Date: Thu, 29 Aug 2013 21:50:45 +0900 (JST)
Subject: [ruby-changes:30647] nagachika:r42726 (ruby_2_0_0): merge revision(s) 42724: [Backport #8238]
nagachika 2013-08-29 21:50:38 +0900 (Thu, 29 Aug 2013) New Revision: 42726 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42726 Log: 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] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_module.rb branches/ruby_2_0_0/version.h branches/ruby_2_0_0/vm_insnhelper.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42725) +++ ruby_2_0_0/ChangeLog (revision 42726) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Thu Aug 29 21:28:56 2013 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42725) +++ ruby_2_0_0/version.h (revision 42726) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #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" Index: ruby_2_0_0/vm_insnhelper.c =================================================================== --- ruby_2_0_0/vm_insnhelper.c (revision 42725) +++ ruby_2_0_0/vm_insnhelper.c (revision 42726) @@ -1739,6 +1739,8 @@ vm_call_method(rb_thread_t *th, rb_contr https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L1739 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_contr https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L1773 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_contr https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L1838 goto normal_method_dispatch; } else { + klass = ci->me->klass; goto zsuper_method_dispatch; } } Index: ruby_2_0_0/test/ruby/test_module.rb =================================================================== --- ruby_2_0_0/test/ruby/test_module.rb (revision 42725) +++ ruby_2_0_0/test/ruby/test_module.rb (revision 42726) @@ -1525,6 +1525,21 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1525 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") Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42724 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/