From 109d71ac71cab09d415a489deb39191735d9d00c Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 27 Dec 2012 16:45:36 +0000 Subject: [PATCH] * variable.c (rb_mod_remove_const): fix segv caused by r38558. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ test/ruby/test_module.rb | 5 +++++ variable.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 352d4adc74..034c0c067e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 27 21:56:56 2012 NARUSE, Yui + + * variable.c (rb_mod_remove_const): fix segv caused by r38558. + Tue Dec 28 01:13:48 2012 James Edward Gray II * lib/csv.rb: Added more Hash methods to CSV::Row. diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 52f643489c..2862cd338f 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1591,4 +1591,9 @@ class TestModule < Test::Unit::TestCase end assert_equal("", stderr) end + + def test_remove_const + m = Module.new + assert_raise(NameError){ m.instance_eval { remove_const(:__FOO__) } } + end end diff --git a/variable.c b/variable.c index 2597015d50..f6bd70a211 100644 --- a/variable.c +++ b/variable.c @@ -1919,7 +1919,7 @@ rb_mod_remove_const(VALUE mod, VALUE name) } else { rb_name_error_str(name, "`%"PRIsVALUE"' is not allowed as a constant name", - QUOTE_ID(name)); + QUOTE(name)); } } if (!rb_is_const_id(id)) {