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

ruby-changes:44743

From: nagachika <ko1@a...>
Date: Wed, 16 Nov 2016 23:41:25 +0900 (JST)
Subject: [ruby-changes:44743] nagachika:r56816 (ruby_2_3): merge revision(s) 56694, 56698: [Backport #12920]

nagachika	2016-11-16 23:41:20 +0900 (Wed, 16 Nov 2016)

  New Revision: 56816

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

  Log:
    merge revision(s) 56694,56698: [Backport #12920]
    
    vm_eval.c: fix refined method when prepended
    
    * vm_eval.c (vm_call0_body): refined module should not be skipped
      as prepended.  [ruby-core:78073] [Bug #12920]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_refinement.rb
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm_eval.c
Index: ruby_2_3/vm_eval.c
===================================================================
--- ruby_2_3/vm_eval.c	(revision 56815)
+++ ruby_2_3/vm_eval.c	(revision 56816)
@@ -200,14 +200,17 @@ vm_call0_body(rb_thread_t* th, struct rb https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_eval.c#L200
       case VM_METHOD_TYPE_REFINED:
 	{
 	    const rb_method_type_t type = cc->me->def->type;
-	    VALUE super_class;
+	    VALUE super_class = cc->me->defined_class;
 
-	    if (type == VM_METHOD_TYPE_REFINED && cc->me->def->body.refined.orig_me) {
+	    if (type == VM_METHOD_TYPE_ZSUPER) {
+		super_class = RCLASS_ORIGIN(super_class);
+	    }
+	    else if (cc->me->def->body.refined.orig_me) {
 		cc->me = refined_method_callable_without_refinement(cc->me);
 		goto again;
 	    }
 
-	    super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class));
+	    super_class = RCLASS_SUPER(super_class);
 
 	    if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) {
 		enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56815)
+++ ruby_2_3/version.h	(revision 56816)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.3"
-#define RUBY_RELEASE_DATE "2016-11-15"
-#define RUBY_PATCHLEVEL 218
+#define RUBY_RELEASE_DATE "2016-11-16"
+#define RUBY_PATCHLEVEL 219
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
 
 #include "ruby/version.h"
 
Index: ruby_2_3/test/ruby/test_refinement.rb
===================================================================
--- ruby_2_3/test/ruby/test_refinement.rb	(revision 56815)
+++ ruby_2_3/test/ruby/test_refinement.rb	(revision 56816)
@@ -1623,6 +1623,20 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_refinement.rb#L1623
     end
   end
 
+  def test_refine_with_prepend
+    assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
+    begin;
+      bug = '[ruby-core:78073] [Bug #12920]'
+      Fixnum.prepend(Module.new)
+      Module.new do
+        refine Fixnum do
+          define_method(:+) {}
+        end
+      end
+      assert_kind_of(Time, Time.now, bug)
+    end;
+  end
+
   private
 
   def eval_using(mod, s)
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 56815)
+++ ruby_2_3/ChangeLog	(revision 56816)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Wed Nov 16 23:40:29 2016  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* vm_eval.c (vm_call0_body): refined module should not be skipped as
+	  prepended. [Bug #12920]
+
 Tue Nov 15 03:14:02 2016  NARUSE, Yui  <naruse@r...>
 
 	* ext/-test/file/fs.c (get_atime_p): Updating of file access times

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56694,56698


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

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