From 03f9e8746e42a4835583678af217cdf4c417bd05 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Sun, 23 Feb 2020 12:49:26 -0800 Subject: Don't tweak RubyVM compile options if it's not defined --- test/ruby/test_settracefunc.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 73cf625258..300033ae7e 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -3,17 +3,21 @@ require 'test/unit' class TestSetTraceFunc < Test::Unit::TestCase def setup - @original_compile_option = RubyVM::InstructionSequence.compile_option - RubyVM::InstructionSequence.compile_option = { - :trace_instruction => true, - :specialized_instruction => false - } + if defined?(RubyVM) + @original_compile_option = RubyVM::InstructionSequence.compile_option + RubyVM::InstructionSequence.compile_option = { + :trace_instruction => true, + :specialized_instruction => false + } + end @target_thread = Thread.current end def teardown set_trace_func(nil) - RubyVM::InstructionSequence.compile_option = @original_compile_option + if defined?(RubyVM) + RubyVM::InstructionSequence.compile_option = @original_compile_option + end @target_thread = nil end -- cgit v1.2.3