Skip to content

Commit 5d59efc

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_2_1@45124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 42ffa2e commit 5d59efc

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Sat Feb 22 17:33:39 2014 Nobuyoshi Nakada <[email protected]>
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
Sat Feb 22 16:51:36 2014 Eric Wong <[email protected]>
27

38
* ext/json/generator/depend: add build dependencies for json extension

eval.c

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

383-
if (argc > 0) {
384-
return rb_mod_constants(argc, argv, rb_cModule);
383+
if (argc > 0 || mod != rb_cModule) {
384+
return rb_mod_constants(argc, argv, mod);
385385
}
386386

387387
while (cref) {

test/ruby/test_module.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,19 @@ def test_mod_constants
866866
m.instance_eval { remove_const(:Foo) }
867867
end
868868

869+
class Bug9413
870+
class << self
871+
Foo = :foo
872+
end
873+
end
874+
875+
def test_singleton_constants
876+
bug9413 = '[ruby-core:59763] [Bug #9413]'
877+
c = Bug9413.singleton_class
878+
assert_include(c.constants(true), :Foo, bug9413)
879+
assert_include(c.constants(false), :Foo, bug9413)
880+
end
881+
869882
def test_frozen_class
870883
m = Module.new
871884
m.freeze

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.1"
22
#define RUBY_RELEASE_DATE "2014-02-22"
3-
#define RUBY_PATCHLEVEL 68
3+
#define RUBY_PATCHLEVEL 69
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 2

0 commit comments

Comments
 (0)