Skip to content

Commit 533487b

Browse files
committed
merge revision(s) 44628: [Backport ruby#9413]
* eval.c (rb_mod_s_constants): return its own constants for other than Module itself. [ruby-core:59763] [Bug ruby#9413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@44939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 9c66947 commit 533487b

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Fri Feb 14 14:58:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* eval.c (rb_mod_s_constants): return its own constants for other
4+
than Module itself. [ruby-core:59763] [Bug #9413]
5+
16
Fri Feb 14 14:40:27 2014 Masaki Matsushita <glass.saga@gmail.com>
27

38
* array.c (rb_hash_rehash): use hash_alloc() instead of rb_hash_new().

eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
313313
VALUE cbase = 0;
314314
void *data = 0;
315315

316-
if (argc > 0) {
317-
return rb_mod_constants(argc, argv, rb_cModule);
316+
if (argc > 0 || mod != rb_cModule) {
317+
return rb_mod_constants(argc, argv, mod);
318318
}
319319

320320
while (cref) {

test/ruby/test_module.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,19 @@ def test_mod_constants
669669
m.instance_eval { remove_const(:Foo) }
670670
end
671671

672+
class Bug9413
673+
class << self
674+
Foo = :foo
675+
end
676+
end
677+
678+
def test_singleton_constants
679+
bug9413 = '[ruby-core:59763] [Bug #9413]'
680+
c = Bug9413.singleton_class
681+
assert_include(c.constants(true), :Foo, bug9413)
682+
assert_include(c.constants(false), :Foo, bug9413)
683+
end
684+
672685
def test_frozen_class
673686
m = Module.new
674687
m.freeze

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define RUBY_VERSION "1.9.3"
2-
#define RUBY_PATCHLEVEL 520
2+
#define RUBY_PATCHLEVEL 521
33

44
#define RUBY_RELEASE_DATE "2014-02-14"
55
#define RUBY_RELEASE_YEAR 2014

0 commit comments

Comments
 (0)