From f9a48548cf3ef54fc0a385ccd78c708737055ecc Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 19 Dec 2023 17:32:19 +0900 Subject: restore the stack pointer on finalizer When error on finalizer, the exception will be ignored. To restart the code, we need to restore the stack pointer. fix [Bug #20042] --- test/ruby/test_gc.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index a577fcb16b..4c4a7f6a27 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -810,6 +810,15 @@ class TestGc < Test::Unit::TestCase obj = nil end end; + + assert_normal_exit "#{<<~"begin;"}\n#{<<~'end;'}", '[Bug #20042]' + begin; + def (f = Object.new).call = nil # missing ID + o = Object.new + ObjectSpace.define_finalizer(o, f) + o = nil + GC.start + end; end def test_object_ids_never_repeat -- cgit v1.2.3