From 0cc0e43745ffc13a596441adccee295274d99a0b Mon Sep 17 00:00:00 2001 From: nagachika Date: Thu, 18 Jan 2024 11:48:46 +0900 Subject: merge revision(s) f9a48548cf3ef54fc0a385ccd78c708737055ecc: [Backport #20042] 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] --- gc.c | 4 ++++ test/ruby/test_gc.rb | 9 +++++++++ 2 files changed, 13 insertions(+) --- 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 4251321119..bb136656ce 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -609,6 +609,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