ruby-changes:36057
From: nagachika <ko1@a...>
Date: Sun, 26 Oct 2014 03:42:51 +0900 (JST)
Subject: [ruby-changes:36057] nagachika:r48138 (ruby_2_1): merge revision(s) r48111, r48118, r48120: [Backport #10421]
nagachika 2014-10-26 03:42:44 +0900 (Sun, 26 Oct 2014) New Revision: 48138 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48138 Log: merge revision(s) r48111,r48118,r48120: [Backport #10421] * vm_method.c (rb_method_entry_make): warn redefinition only for already defined methods, but not for undefined methods. [ruby-dev:48691] [Bug #10421] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/test/ruby/test_object.rb branches/ruby_2_1/version.h branches/ruby_2_1/vm_method.c Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 48137) +++ ruby_2_1/ChangeLog (revision 48138) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Sun Oct 26 03:31:46 2014 Nobuyoshi Nakada <nobu@r...> + + * vm_method.c (rb_method_entry_make): warn redefinition only for + already defined methods, but not for undefined methods. + [ruby-dev:48691] [Bug #10421] + Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada <nobu@r...> * class.c (unknown_keyword_error): delete expected keywords Index: ruby_2_1/vm_method.c =================================================================== --- ruby_2_1/vm_method.c (revision 48137) +++ ruby_2_1/vm_method.c (revision 48138) @@ -181,6 +181,7 @@ rb_free_method_entry(rb_method_entry_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_method.c#L181 xfree(me); } +static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr); static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); static inline rb_method_entry_t * @@ -355,7 +356,7 @@ rb_method_entry_make(VALUE klass, ID mid https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_method.c#L356 } /* check mid */ if (mid == object_id || mid == id__send__) { - if (type == VM_METHOD_TYPE_ISEQ) { + if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) { rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid)); } } Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 48137) +++ ruby_2_1/version.h (revision 48138) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-26" -#define RUBY_PATCHLEVEL 263 +#define RUBY_PATCHLEVEL 264 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 Index: ruby_2_1/test/ruby/test_object.rb =================================================================== --- ruby_2_1/test/ruby/test_object.rb (revision 48137) +++ ruby_2_1/test/ruby/test_object.rb (revision 48138) @@ -298,6 +298,15 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_object.rb#L298 $VERBOSE = false def (Object.new).__send__; end INPUT + + bug10421 = '[ruby-dev:48691] [Bug #10421]' + assert_in_out_err([], <<-INPUT, ["1"], [], bug10421) + $VERBOSE = false + class C < BasicObject + def object_id; 1; end + end + puts C.new.object_id + INPUT end def test_remove_method Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48111,48118,48120 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/