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

ruby-changes:38050

From: nagachika <ko1@a...>
Date: Tue, 31 Mar 2015 00:45:47 +0900 (JST)
Subject: [ruby-changes:38050] nagachika:r50131 (ruby_2_1): merge revision(s) r49184: [Backport #10707]

nagachika	2015-03-31 00:45:35 +0900 (Tue, 31 Mar 2015)

  New Revision: 50131

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

  Log:
    merge revision(s) r49184: [Backport #10707]
    
    * vm_method.c (rb_method_entry): if no super class, no original
      method entry.  [ruby-core:67389] [Bug #10707]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/test/ruby/test_refinement.rb
    branches/ruby_2_1/version.h
    branches/ruby_2_1/vm_method.c
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 50130)
+++ ruby_2_1/ChangeLog	(revision 50131)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Tue Mar 31 00:38:14 2015  Seiei Higa  <hanachin@g...>
+
+	* vm_method.c (rb_method_entry): if no super class, no original
+	  method entry.  [ruby-core:67389] [Bug #10707]
+
 Tue Mar 31 00:34:39 2015  Vit Ondruch  <vondruch@r...>
 
 	* configure.in (RUBY_SETJMP_TYPE): Remove superfluous semicolon
Index: ruby_2_1/vm_method.c
===================================================================
--- ruby_2_1/vm_method.c	(revision 50130)
+++ ruby_2_1/vm_method.c	(revision 50131)
@@ -639,12 +639,17 @@ get_original_method_entry(VALUE refineme https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_method.c#L639
 			  const rb_method_entry_t *me,
 			  VALUE *defined_class_ptr)
 {
+    VALUE super;
+
     if (me->def->body.orig_me) {
 	return me->def->body.orig_me;
     }
+    else if (!(super = RCLASS_SUPER(me->klass))) {
+	return 0;
+    }
     else {
 	rb_method_entry_t *tmp_me;
-	tmp_me = rb_method_entry(RCLASS_SUPER(me->klass), me->called_id,
+	tmp_me = rb_method_entry(super, me->called_id,
 				 defined_class_ptr);
 	return rb_resolve_refined_method(refinements, tmp_me,
 					 defined_class_ptr);
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 50130)
+++ ruby_2_1/version.h	(revision 50131)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.5"
 #define RUBY_RELEASE_DATE "2015-03-31"
-#define RUBY_PATCHLEVEL 326
+#define RUBY_PATCHLEVEL 327
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_1/test/ruby/test_refinement.rb
===================================================================
--- ruby_2_1/test/ruby/test_refinement.rb	(revision 50130)
+++ ruby_2_1/test/ruby/test_refinement.rb	(revision 50131)
@@ -1165,6 +1165,19 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_refinement.rb#L1165
 
     assert_raise(NoMethodError, bug10106) {Object.new.foo}
     end;
+
+    assert_separately([], <<-"end;")
+    bug10707 = '[ruby-core:67389] [Bug #10707]'
+    module RefinementBug
+      refine BasicObject do
+        def foo
+        end
+      end
+    end
+
+    assert(methods, bug10707)
+    assert_raise(NameError, bug10707) {method(:foo)}
+    end;
   end
 
   def test_change_refined_new_method_visibility

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49184


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

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