summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 08:38:43 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 08:38:43 +0000
commit330dccb9b444ec93660bf9e03fb7fa1b1c8619b8 (patch)
tree53ea1729c8ad0b625a1de2dd9a40affd7711e991
parent7329f4043621e69574187fb185939d5638838a7b (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--eval.c4
-rw-r--r--test/ruby/test_module.rb13
-rw-r--r--version.h2
4 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f0c9ca0313..8abc8943b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Feb 22 17:33:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@80x24.org>
* ext/json/generator/depend: add build dependencies for json extension
diff --git a/eval.c b/eval.c
index 3a0206f24a..841b3671e3 100644
--- a/eval.c
+++ b/eval.c
@@ -380,8 +380,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
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) {
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 4f834f0c1e..ba6f273159 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -866,6 +866,19 @@ class TestModule < Test::Unit::TestCase
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
diff --git a/version.h b/version.h
index bfcb361b41..6de4c639a7 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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