summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_module.rb2
-rw-r--r--variable.c4
-rw-r--r--version.h2
4 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bada4cfe09..2d4e6e4051 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* regcomp.c (compile_length_tree): return error code immediately
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 2f3e5c2ae2..b70e6666ff 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -589,6 +589,8 @@ class TestModule < Test::Unit::TestCase
const_set(:X, 123)
end
assert_equal(false, klass.class_eval { Module.constants }.include?(:X))
+
+ assert_equal(false, Complex.constants(false).include?(:compatible))
end
module M1
diff --git a/variable.c b/variable.c
index 5b0b5d8e89..2c85ae155d 100644
--- a/variable.c
+++ b/variable.c
@@ -1999,7 +1999,9 @@ 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)
{
- 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;
}
diff --git a/version.h b/version.h
index 9f9bd8f408..113cd38f25 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.6"
#define RUBY_RELEASE_DATE "2016-06-10"
-#define RUBY_PATCHLEVEL 331
+#define RUBY_PATCHLEVEL 332
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 6