[前][次][番号順一覧][スレッド一覧]

ruby-changes:36068

From: usa <ko1@a...>
Date: Mon, 27 Oct 2014 13:28:18 +0900 (JST)
Subject: [ruby-changes:36068] usa:r48149 (ruby_2_0_0): merge revision(s) 48111, 48118, 48120: [Backport #10421]

usa	2014-10-27 13:28:03 +0900 (Mon, 27 Oct 2014)

  New Revision: 48149

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48149

  Log:
    merge revision(s) 48111,48118,48120: [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_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_object.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 48148)
+++ ruby_2_0_0/ChangeLog	(revision 48149)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Oct 27 13:26: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]
+
 Thu Oct 23 18:56:55 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override
Index: ruby_2_0_0/vm_method.c
===================================================================
--- ruby_2_0_0/vm_method.c	(revision 48148)
+++ ruby_2_0_0/vm_method.c	(revision 48149)
@@ -172,6 +172,7 @@ rb_free_method_entry(rb_method_entry_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L172
     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 *
@@ -332,7 +333,7 @@ rb_method_entry_make(VALUE klass, ID mid https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L333
     }
     /* 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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 48148)
+++ ruby_2_0_0/version.h	(revision 48149)
@@ -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 "2014-10-23"
-#define RUBY_PATCHLEVEL 592
+#define RUBY_RELEASE_DATE "2014-10-27"
+#define RUBY_PATCHLEVEL 593
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 23
+#define RUBY_RELEASE_DAY 27
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_object.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_object.rb	(revision 48148)
+++ ruby_2_0_0/test/ruby/test_object.rb	(revision 48149)
@@ -285,6 +285,15 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_object.rb#L285
       $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_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r48111,48118,48120


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]