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

ruby-changes:28375

From: nagachika <ko1@a...>
Date: Tue, 23 Apr 2013 23:33:02 +0900 (JST)
Subject: [ruby-changes:28375] nagachika:r40427 (ruby_2_0_0): merge revision(s) 40346: [Backport #8284]

nagachika	2013-04-23 23:32:49 +0900 (Tue, 23 Apr 2013)

  New Revision: 40427

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

  Log:
    merge revision(s) 40346: [Backport #8284]
    
    * vm_method.c (rb_mod_public_method): fix visibility on anonymous
      module. set visibility of singleton method, not method in base
      class.  [ruby-core:54404] [Bug #8284]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    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 40426)
+++ ruby_2_0_0/ChangeLog	(revision 40427)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Apr 23 23:06:43 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_method.c (rb_mod_public_method): fix visibility on anonymous
+	  module. set visibility of singleton method, not method in base
+	  class.  [ruby-core:54404] [Bug #8284]
+
 Tue Apr 23 22:33:16 2013  Shugo Maeda  <shugo@r...>
 
 	* lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
Index: ruby_2_0_0/vm_method.c
===================================================================
--- ruby_2_0_0/vm_method.c	(revision 40426)
+++ ruby_2_0_0/vm_method.c	(revision 40427)
@@ -1359,7 +1359,7 @@ rb_mod_private(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L1359
 static VALUE
 rb_mod_public_method(int argc, VALUE *argv, VALUE obj)
 {
-    set_method_visibility(CLASS_OF(obj), argc, argv, NOEX_PUBLIC);
+    set_method_visibility(rb_singleton_class(obj), argc, argv, NOEX_PUBLIC);
     return obj;
 }
 
@@ -1382,7 +1382,7 @@ rb_mod_public_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L1382
 static VALUE
 rb_mod_private_method(int argc, VALUE *argv, VALUE obj)
 {
-    set_method_visibility(CLASS_OF(obj), argc, argv, NOEX_PRIVATE);
+    set_method_visibility(rb_singleton_class(obj), argc, argv, NOEX_PRIVATE);
     return obj;
 }
 
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40426)
+++ ruby_2_0_0/version.h	(revision 40427)
@@ -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-23"
-#define RUBY_PATCHLEVEL 162
+#define RUBY_PATCHLEVEL 163
 
 #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 40426)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 40427)
@@ -1675,6 +1675,13 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1675
     end
   end
 
+  def test_anonymous_module_public_class_method
+    bug8284 = '[ruby-core:54404] [Bug #8284]'
+    assert_raise(NoMethodError) {Object.define_method}
+    Module.new.public_class_method(:define_method)
+    assert_raise(NoMethodError, bug8284) {Object.define_method}
+  end
+
   private
 
   def assert_top_method_is_private(method)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40346


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

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