ruby-changes:65197
From: Nobuyoshi <ko1@a...>
Date: Tue, 9 Feb 2021 12:59:34 +0900 (JST)
Subject: [ruby-changes:65197] 97cf290063 (master): Copy va_list of exception classes
https://git.ruby-lang.org/ruby.git/commit/?id=97cf290063 From 97cf290063ab940d08819cd96cbcca0ef6d50e4c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 9 Feb 2021 00:42:12 +0900 Subject: Copy va_list of exception classes The list is reused when an exception raised again after retrying in the rescue procedure. --- eval.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eval.c b/eval.c index 2c9e375..55d66b5 100644 --- a/eval.c +++ b/eval.c @@ -1033,14 +1033,18 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1, https://github.com/ruby/ruby/blob/trunk/eval.c#L1033 if (state == TAG_RAISE) { int handle = FALSE; VALUE eclass; + va_list ap; result = Qnil; - while ((eclass = va_arg(args, VALUE)) != 0) { + /* reuses args when raised again after retrying in r_proc */ + va_copy(ap, args); + while ((eclass = va_arg(ap, VALUE)) != 0) { if (rb_obj_is_kind_of(ec->errinfo, eclass)) { handle = TRUE; break; } } + va_end(ap); if (handle) { state = TAG_NONE; -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/