summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-26 14:58:41 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-26 14:58:41 +0000
commita669f1f992105981efd4bb891d34cbf53b05696a (patch)
tree1b75d3c5f376bd54a51e26a837d3771e7632b979
parentdce01373fd866e8ac77ed3d3b1b148044d2259af (diff)
merge revision(s) 56117,56118: [Backport #12742]
* variable.c (rb_const_search): raise with the actual class/module name which defines the private constant. * variable.c (rb_const_search): warn with the actual class/module name which defines the deprecated constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_module.rb4
-rw-r--r--variable.c4
-rw-r--r--version.h2
4 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d60e7d8b94..bd98a75660 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep 26 23:51:31 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_const_search): raise with the actual class/module
+ name which defines the private constant.
+
Mon Sep 26 23:34:09 2016 Kazuki Yamaguchi <k@rhe.jp>
* ext/openssl/ossl_pkcs12.c (ossl_pkcs12_initialize): pop errors
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 06744b5249..b155ad7206 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1362,6 +1362,9 @@ class TestModule < Test::Unit::TestCase
c.const_set(:FOO, "foo")
$VERBOSE = verbose
assert_raise(NameError) { c::FOO }
+ assert_raise_with_message(NameError, /#{c}::FOO/) do
+ Class.new(c)::FOO
+ end
end
def test_private_constant2
@@ -1419,6 +1422,7 @@ class TestModule < Test::Unit::TestCase
c.const_set(:FOO, "foo")
c.deprecate_constant(:FOO)
assert_warn(/deprecated/) {c::FOO}
+ assert_warn(/#{c}::FOO is deprecated/) {Class.new(c)::FOO}
bug12382 = '[ruby-core:75505] [Bug #12382]'
assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"}
end
diff --git a/variable.c b/variable.c
index 3690c1bddd..618aa852bd 100644
--- a/variable.c
+++ b/variable.c
@@ -2238,9 +2238,9 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
while ((ce = rb_const_lookup(tmp, id))) {
if (visibility && RB_CONST_PRIVATE_P(ce)) {
rb_name_err_raise("private constant %2$s::%1$s referenced",
- klass, ID2SYM(id));
+ tmp, ID2SYM(id));
}
- rb_const_warn_if_deprecated(ce, klass, id);
+ rb_const_warn_if_deprecated(ce, tmp, id);
value = ce->value;
if (value == Qundef) {
if (am == tmp) break;
diff --git a/version.h b/version.h
index ed26ee9b6a..da1a28387a 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-09-26"
-#define RUBY_PATCHLEVEL 191
+#define RUBY_PATCHLEVEL 192
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 9