ruby-changes:27513
From: nagachika <ko1@a...>
Date: Sun, 3 Mar 2013 02:18:09 +0900 (JST)
Subject: [ruby-changes:27513] nagachika:r39565 (ruby_2_0_0): merge revision(s) 39234,39235: [Backport #7843]
nagachika 2013-03-03 02:17:59 +0900 (Sun, 03 Mar 2013) New Revision: 39565 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39565 Log: merge revision(s) 39234,39235: [Backport #7843] * vm_method.c: call method_removed hook on called class, not on prepending iclass. prepending iclass. [ruby-core:52207] [Bug #7843] 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_method.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 39564) +++ ruby_2_0_0/ChangeLog (revision 39565) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sun Mar 3 02:16:24 2013 Nobuyoshi Nakada <nobu@r...> + + * vm_method.c: call method_removed hook on called class, not on + prepending iclass. [ruby-core:52207] [Bug #7843] + Sun Mar 3 01:57:50 2013 Nobuyoshi Nakada <nobu@r...> * configure.in (warnflags): disable -Werror by default unless Index: ruby_2_0_0/vm_method.c =================================================================== --- ruby_2_0_0/vm_method.c (revision 39564) +++ ruby_2_0_0/vm_method.c (revision 39565) @@ -648,6 +648,7 @@ remove_method(VALUE klass, ID mid) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L648 { st_data_t key, data; rb_method_entry_t *me = 0; + VALUE self = klass; klass = RCLASS_ORIGIN(klass); if (klass == rb_cObject) { @@ -674,7 +675,7 @@ remove_method(VALUE klass, ID mid) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L675 rb_clear_cache_for_undef(klass, mid); rb_unlink_method_entry(me); - CALL_METHOD_HOOK(klass, removed, mid); + CALL_METHOD_HOOK(self, removed, mid); } void Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 39564) +++ ruby_2_0_0/version.h (revision 39565) @@ -1,6 +1,6 @@ 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-03-03" -#define RUBY_PATCHLEVEL 4 +#define RUBY_PATCHLEVEL 5 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_0_0/test/ruby/test_module.rb =================================================================== --- ruby_2_0_0/test/ruby/test_module.rb (revision 39564) +++ ruby_2_0_0/test/ruby/test_module.rb (revision 39565) @@ -1382,12 +1382,27 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1382 end def test_prepend_remove_method + c = Class.new do + prepend Module.new {def foo; end} + end assert_raise(NameError) do - Class.new do - prepend Module.new {def foo; end} + c.class_eval do + remove_method(:foo) + end + end + c.class_eval do + def foo; end + end + removed = nil + c.singleton_class.class_eval do + define_method(:method_removed) {|id| removed = id} + end + assert_nothing_raised(NoMethodError, NameError, '[Bug #7843]') do + c.class_eval do remove_method(:foo) end end + assert_equal(:foo, removed) end def test_prepend_class_ancestors Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r39234-39235 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/