From b0aa1ff399104be55611c4922e987cefe69bee92 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 29 Mar 2016 14:59:32 +0000 Subject: merge revision(s) 53875: [Backport #12089] * object.c (rb_mod_const_get): make error message at uninterned string consistent with symbols. [ruby-dev:49498] [Bug #12089] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ object.c | 2 +- test/-ext-/symbol/test_inadvertent_creation.rb | 8 ++++++++ version.h | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05963a56a1..aadfa9f5d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 29 23:54:31 2016 Nobuyoshi Nakada + + * object.c (rb_mod_const_get): make error message at uninterned + string consistent with symbols. [ruby-dev:49498] [Bug #12089] + Tue Mar 29 23:45:24 2016 Nobuyoshi Nakada * dir.c (push_pattern, push_glob): deal with read paths as UTF-8 diff --git a/object.c b/object.c index 99f58a8f6c..3c502d5c0f 100644 --- a/object.c +++ b/object.c @@ -2142,7 +2142,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) continue; } else { - rb_name_err_raise("uninitialized constant %2$s::%1$s", mod, part); + rb_mod_const_missing(mod, part); } } if (!rb_is_const_id(id)) { diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb index 073952fae3..5d3906a40b 100644 --- a/test/-ext-/symbol/test_inadvertent_creation.rb +++ b/test/-ext-/symbol/test_inadvertent_creation.rb @@ -54,6 +54,14 @@ module Test_Symbol assert_not_interned_error(cl, :const_get, name.to_sym) end + def test_module_const_get_toplevel + bug12089 = '[ruby-dev:49498] [Bug #12089]' + name = noninterned_name("A") + e = assert_not_interned_error(Object, :const_get, name) + assert_equal(name, e.name) + assert_not_match(/Object::/, e.message, bug12089) + end + def test_module_const_defined? cl = Class.new name = noninterned_name("A") diff --git a/version.h b/version.h index c1537f44fe..d6088e06cc 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.0" #define RUBY_RELEASE_DATE "2016-03-29" -#define RUBY_PATCHLEVEL 56 +#define RUBY_PATCHLEVEL 57 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 -- cgit v1.2.3