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

ruby-changes:33045

From: naruse <ko1@a...>
Date: Sat, 22 Feb 2014 17:38:51 +0900 (JST)
Subject: [ruby-changes:33045] naruse:r45124 (ruby_2_1): merge revision(s) 44628: [Backport #9413]

naruse	2014-02-22 17:38:43 +0900 (Sat, 22 Feb 2014)

  New Revision: 45124

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

  Log:
    merge revision(s) 44628: [Backport #9413]
    
    * eval.c (rb_mod_s_constants): return its own constants for other
      than Module itself.  [ruby-core:59763] [Bug #9413]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/eval.c
    branches/ruby_2_1/test/ruby/test_module.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 45123)
+++ ruby_2_1/ChangeLog	(revision 45124)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Sat Feb 22 17:33:39 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (rb_mod_s_constants): return its own constants for other
+	  than Module itself.  [ruby-core:59763] [Bug #9413]
+
 Sat Feb 22 16:51:36 2014  Eric Wong <e@8...>
 
 	* ext/json/generator/depend: add build dependencies for json extension
Index: ruby_2_1/eval.c
===================================================================
--- ruby_2_1/eval.c	(revision 45123)
+++ ruby_2_1/eval.c	(revision 45124)
@@ -380,8 +380,8 @@ rb_mod_s_constants(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_1/eval.c#L380
     VALUE cbase = 0;
     void *data = 0;
 
-    if (argc > 0) {
-	return rb_mod_constants(argc, argv, rb_cModule);
+    if (argc > 0 || mod != rb_cModule) {
+	return rb_mod_constants(argc, argv, mod);
     }
 
     while (cref) {
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 45123)
+++ ruby_2_1/version.h	(revision 45124)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.1"
 #define RUBY_RELEASE_DATE "2014-02-22"
-#define RUBY_PATCHLEVEL 68
+#define RUBY_PATCHLEVEL 69
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
Index: ruby_2_1/test/ruby/test_module.rb
===================================================================
--- ruby_2_1/test/ruby/test_module.rb	(revision 45123)
+++ ruby_2_1/test/ruby/test_module.rb	(revision 45124)
@@ -866,6 +866,19 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_module.rb#L866
     m.instance_eval { remove_const(:Foo) }
   end
 
+  class Bug9413
+    class << self
+      Foo = :foo
+    end
+  end
+
+  def test_singleton_constants
+    bug9413 = '[ruby-core:59763] [Bug #9413]'
+    c = Bug9413.singleton_class
+    assert_include(c.constants(true), :Foo, bug9413)
+    assert_include(c.constants(false), :Foo, bug9413)
+  end
+
   def test_frozen_class
     m = Module.new
     m.freeze

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


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

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