merge revision(s) 55182: [Backport #12389]

* variable.c (rb_local_constants_i): exclude hidden constants.
	  [ruby-core:75575] [Bug #12389]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-06-10 07:14:44 +00:00
parent 21aef91673
commit bcd3f78637
4 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Jun 10 16:12:58 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_local_constants_i): exclude hidden constants.
[ruby-core:75575] [Bug #12389]
Fri Jun 10 16:10:23 2016 NARUSE, Yui <naruse@ruby-lang.org> Fri Jun 10 16:10:23 2016 NARUSE, Yui <naruse@ruby-lang.org>
* regcomp.c (compile_length_tree): return error code immediately * regcomp.c (compile_length_tree): return error code immediately

View file

@ -589,6 +589,8 @@ class TestModule < Test::Unit::TestCase
const_set(:X, 123) const_set(:X, 123)
end end
assert_equal(false, klass.class_eval { Module.constants }.include?(:X)) assert_equal(false, klass.class_eval { Module.constants }.include?(:X))
assert_equal(false, Complex.constants(false).include?(:compatible))
end end
module M1 module M1

View file

@ -1999,7 +1999,9 @@ sv_i(st_data_t k, st_data_t v, st_data_t a)
static int static int
rb_local_constants_i(st_data_t const_name, st_data_t const_value, st_data_t ary) rb_local_constants_i(st_data_t const_name, st_data_t const_value, st_data_t ary)
{ {
rb_ary_push((VALUE)ary, ID2SYM((ID)const_name)); if (rb_is_const_id(const_name)) {
rb_ary_push((VALUE)ary, ID2SYM((ID)const_name));
}
return ST_CONTINUE; return ST_CONTINUE;
} }

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.6" #define RUBY_VERSION "2.2.6"
#define RUBY_RELEASE_DATE "2016-06-10" #define RUBY_RELEASE_DATE "2016-06-10"
#define RUBY_PATCHLEVEL 331 #define RUBY_PATCHLEVEL 332
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 6 #define RUBY_RELEASE_MONTH 6