ruby-changes:44186
From: nagachika <ko1@a...>
Date: Mon, 26 Sep 2016 23:58:46 +0900 (JST)
Subject: [ruby-changes:44186] nagachika:r56259 (ruby_2_3): merge revision(s) 56117, 56118: [Backport #12742]
nagachika 2016-09-26 23:58:41 +0900 (Mon, 26 Sep 2016) New Revision: 56259 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56259 Log: 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. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/ruby/test_module.rb branches/ruby_2_3/variable.c branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 56258) +++ ruby_2_3/ChangeLog (revision 56259) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Mon Sep 26 23:51:31 2016 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * ext/openssl/ossl_pkcs12.c (ossl_pkcs12_initialize): pop errors Index: ruby_2_3/test/ruby/test_module.rb =================================================================== --- ruby_2_3/test/ruby/test_module.rb (revision 56258) +++ ruby_2_3/test/ruby/test_module.rb (revision 56259) @@ -1362,6 +1362,9 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_module.rb#L1362 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 https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_module.rb#L1422 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 Index: ruby_2_3/variable.c =================================================================== --- ruby_2_3/variable.c (revision 56258) +++ ruby_2_3/variable.c (revision 56259) @@ -2238,9 +2238,9 @@ rb_const_get_0(VALUE klass, ID id, int e https://github.com/ruby/ruby/blob/trunk/ruby_2_3/variable.c#L2238 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; Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 56258) +++ ruby_2_3/version.h (revision 56259) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #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 Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r56117-56118 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/