From c0df0a85dec77a09308caddb1e1efd4d38fbf7b8 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Fri, 20 Jan 2023 17:01:47 +0900 Subject: merge revision(s) ed6fbb79e19bf401db0e85447fee955fd10a25c7: [Backport #19339] Fix crash when defining ivars on special constants [Bug #19339] --- test/ruby/test_variable.rb | 6 ++++++ vm_insnhelper.c | 5 +++++ 2 files changed, 11 insertions(+) --- test/ruby/test_variable.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby/test_variable.rb') diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index f8a7c68fd3..9acba39f40 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -261,6 +261,12 @@ class TestVariable < Test::Unit::TestCase v.instance_variable_set(:@foo, :bar) end + assert_raise_with_message(FrozenError, msg, "[Bug #19339]") do + v.instance_eval do + @a = 1 + end + end + assert_nil EnvUtil.suppress_warning {v.instance_variable_get(:@foo)} assert_not_send([v, :instance_variable_defined?, :@foo]) -- cgit v1.2.3