merge revision(s) r44628: [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_0_0@45010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-02-16 16:32:08 +00:00
parent bdcadb8c44
commit 37e3fd8802
4 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 17 01:18:04 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]
Mon Feb 17 01:16:00 2014 Eric Wong <e@80x24.org> Mon Feb 17 01:16:00 2014 Eric Wong <e@80x24.org>
* ext/json/generator/depend: add build dependencies for json extension * ext/json/generator/depend: add build dependencies for json extension

4
eval.c
View file

@ -377,8 +377,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
VALUE cbase = 0; VALUE cbase = 0;
void *data = 0; void *data = 0;
if (argc > 0) { if (argc > 0 || mod != rb_cModule) {
return rb_mod_constants(argc, argv, rb_cModule); return rb_mod_constants(argc, argv, mod);
} }
while (cref) { while (cref) {

View file

@ -777,6 +777,19 @@ class TestModule < Test::Unit::TestCase
m.instance_eval { remove_const(:Foo) } m.instance_eval { remove_const(:Foo) }
end 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 def test_frozen_class
m = Module.new m = Module.new
m.freeze m.freeze

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-02-17" #define RUBY_RELEASE_DATE "2014-02-17"
#define RUBY_PATCHLEVEL 428 #define RUBY_PATCHLEVEL 429
#define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 2 #define RUBY_RELEASE_MONTH 2