summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_module.rb2
-rw-r--r--variable.c2
-rw-r--r--version.h2
4 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 88921a4be1..91012157b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Aug 12 03:30:59 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_local_constants_i): exclude private constants
+ when excluding inherited constants too. [Bug #12345]
+
Fri Aug 12 03:00:05 2016 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/timeridconv.rb: don't use keeper thread. [Bug #12342]
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 1e5e5a428d..06744b5249 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1425,6 +1425,8 @@ class TestModule < Test::Unit::TestCase
def test_constants_with_private_constant
assert_not_include(::TestModule.constants, :PrivateClass)
+ assert_not_include(::TestModule.constants(true), :PrivateClass)
+ assert_not_include(::TestModule.constants(false), :PrivateClass)
end
def test_toplevel_private_constant
diff --git a/variable.c b/variable.c
index 1a18c379fd..3690c1bddd 100644
--- a/variable.c
+++ b/variable.c
@@ -2376,7 +2376,7 @@ sv_i(st_data_t k, st_data_t v, st_data_t a)
static int
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));
}
return ST_CONTINUE;
diff --git a/version.h b/version.h
index 0790a587d9..c9123f8ef1 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-08-12"
-#define RUBY_PATCHLEVEL 148
+#define RUBY_PATCHLEVEL 149
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 8