Project

General

Profile

Backport #9168 » backport_r44260_to_ruby_2_0_0.patch

nagachika (Tomoyuki Chikanaga), 12/21/2013 10:42 PM

View differences:

gc.c (working copy)
int status;
VALUE args[3];
VALUE objid = nonspecial_obj_id(obj);
VALUE saved_errinfo = rb_errinfo();
if (RARRAY_LEN(table) > 0) {
args[1] = rb_obj_freeze(rb_ary_new3(1, objid));
......
}
args[2] = (VALUE)rb_safe_level();
rb_set_errinfo(Qnil);
for (i=0; i<RARRAY_LEN(table); i++) {
VALUE final = RARRAY_PTR(table)[i];
args[0] = RARRAY_PTR(final)[1];
......
if (status)
rb_set_errinfo(Qnil);
}
GET_THREAD()->errinfo = saved_errinfo;
}
static void
test/ruby/test_gc.rb (working copy)
end;
end
end
def test_exception_in_finalizer
bug9168 = '[ruby-core:58652] [Bug #9168]'
assert_normal_exit(<<-'end;', bug9168)
raise_proc = proc {raise}
10000.times do
ObjectSpace.define_finalizer(Object.new, raise_proc)
Thread.handle_interrupt(RuntimeError => :immediate) {break}
Thread.handle_interrupt(RuntimeError => :on_blocking) {break}
Thread.handle_interrupt(RuntimeError => :never) {break}
end
end;
end
end
ChangeLog (working copy)
Sat Dec 21 22:16:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_trace.c (rb_postponed_job_flush): isolate exceptions in
postponed jobs and restore outer ones. based on a patch by
tarui. [ruby-core:58652] [Bug #9168]
Sat Dec 21 16:16:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (finalize_deferred): flush all deferred finalizers while other
vm_trace.c (working copy)
const int outer_state = th->state;
int state = 0;
th->state = 0;
th->errinfo = Qnil;
th->vm->trace_running++;
th->trace_arg = trace_arg;
(2-2/2)