merge revision(s) 55705: [Backport #12345]

* variable.c (rb_local_constants_i): exclude private constants
	  when excluding inherited constants too.  [Bug #12345]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-08-16 05:56:26 +00:00
parent 0d09e1af49
commit caec808f74
4 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Tue Aug 16 14:54:14 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_local_constants_i): exclude private constants
when excluding inherited constants too. [Bug #12345]
Tue Aug 16 14:43:00 2016 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp> Tue Aug 16 14:43:00 2016 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/timeridconv.rb: don't use keeper thread. [Bug #12342] * lib/drb/timeridconv.rb: don't use keeper thread. [Bug #12342]

View file

@ -1360,6 +1360,8 @@ class TestModule < Test::Unit::TestCase
def test_constants_with_private_constant def test_constants_with_private_constant
assert_not_include(::TestModule.constants, :PrivateClass) assert_not_include(::TestModule.constants, :PrivateClass)
assert_not_include(::TestModule.constants(true), :PrivateClass)
assert_not_include(::TestModule.constants(false), :PrivateClass)
end end
def test_toplevel_private_constant def test_toplevel_private_constant

View file

@ -1999,7 +1999,7 @@ 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)
{ {
if (rb_is_const_id(const_name)) { if (rb_is_const_id(const_name) && !RB_CONST_PRIVATE_P((rb_const_entry_t *)const_value)) {
rb_ary_push((VALUE)ary, ID2SYM((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-08-16" #define RUBY_RELEASE_DATE "2016-08-16"
#define RUBY_PATCHLEVEL 358 #define RUBY_PATCHLEVEL 359
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8