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

ruby-changes:28200

From: nagachika <ko1@a...>
Date: Fri, 12 Apr 2013 02:19:43 +0900 (JST)
Subject: [ruby-changes:28200] nagachika:r40252 (ruby_2_0_0): merge revision(s) 39742,39743: [Backport #8005]

nagachika	2013-04-12 02:19:28 +0900 (Fri, 12 Apr 2013)

  New Revision: 40252

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

  Log:
    merge revision(s) 39742,39743: [Backport #8005]
    
    assertions.rb: private flag
    
    * lib/test/unit/assertions.rb (assert_respond_to): accept optional
      include-private flag.
    * vm_method.c (rb_export_method): directly override the flag of method
      defined in prepending class too, not adding zsuper entry.
      [ruby-core:53106] [Bug #8005]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/test/unit/assertions.rb
    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 40251)
+++ ruby_2_0_0/ChangeLog	(revision 40252)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Apr 12 02:10:09 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_method.c (rb_export_method): directly override the flag of method
+	  defined in prepending class too, not adding zsuper entry.
+	  [ruby-core:53106] [Bug #8005]
+
 Fri Apr 12 01:57:52 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/fileutils.rb:  Revert r34669 which altered the way
Index: ruby_2_0_0/lib/test/unit/assertions.rb
===================================================================
--- ruby_2_0_0/lib/test/unit/assertions.rb	(revision 40251)
+++ ruby_2_0_0/lib/test/unit/assertions.rb	(revision 40252)
@@ -250,7 +250,13 @@ EOT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/test/unit/assertions.rb#L250
       #
       #    assert_respond_to("hello", :reverse)  #Succeeds
       #    assert_respond_to("hello", :does_not_exist)  #Fails
-      def assert_respond_to obj, meth, msg = nil
+      def assert_respond_to obj, (meth, priv), msg = nil
+        if priv
+          msg = message(msg) {
+            "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}"
+          }
+          return assert obj.respond_to?(meth, priv), msg
+        end
         #get rid of overcounting
         super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth)
       end
Index: ruby_2_0_0/vm_method.c
===================================================================
--- ruby_2_0_0/vm_method.c	(revision 40251)
+++ ruby_2_0_0/vm_method.c	(revision 40252)
@@ -752,7 +752,8 @@ rb_export_method(VALUE klass, ID name, r https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L752
     if (me->flag != noex) {
 	rb_vm_check_redefinition_opt_method(me, klass);
 
-	if (klass == defined_class) {
+	if (klass == defined_class ||
+	    RCLASS_ORIGIN(klass) == defined_class) {
 	    me->flag = noex;
 	    if (me->def->type == VM_METHOD_TYPE_REFINED) {
 		me->def->body.orig_me->flag = noex;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40251)
+++ ruby_2_0_0/version.h	(revision 40252)
@@ -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-04-12"
-#define RUBY_PATCHLEVEL 113
+#define RUBY_PATCHLEVEL 114
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_0_0/test/ruby/test_module.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_module.rb	(revision 40251)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 40252)
@@ -1489,6 +1489,18 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1489
     assert_equal(0, 1 / 2)
   end
 
+  def test_prepend_visibility
+    bug8005 = '[ruby-core:53106] [Bug #8005]'
+    c = Class.new do
+      prepend Module.new {}
+      def foo() end
+      protected :foo
+    end
+    a = c.new
+    assert_respond_to a, [:foo, true]
+    assert_nothing_raised(NoMethodError) {a.send :foo}
+  end
+
   def test_class_variables
     m = Module.new
     m.class_variable_set(:@@foo, 1)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39742-39743


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

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