From 70e9489f9ea85ddaa68fb43398c14a3921cacb27 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Wed, 3 Mar 2021 17:35:47 +0900 Subject: merge revision(s) 0d89aedb734372bc35d8a569a992d13e86e7923e,a6f5f3cccda381ae332aaa6467f2644611371fb5,97cf290063ab940d08819cd96cbcca0ef6d50e4c: [Backport #17338] Assign TAG_NONE to ruby_tag_type instead of 0 --- eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Also `eclass` loop can raise in `rb_obj_is_kind_of` --- eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(-) --- eval.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 55ac8b4eac..839518185a 100644 --- a/eval.c +++ b/eval.c @@ -1021,7 +1021,7 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1, else if (result) { /* escape from r_proc */ if (state == TAG_RETRY) { - state = 0; + state = TAG_NONE; ec->errinfo = Qnil; result = Qfalse; goto retry_entry; @@ -1033,17 +1033,21 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1, if (state == TAG_RAISE) { int handle = FALSE; VALUE eclass; + va_list ap; - while ((eclass = va_arg(args, VALUE)) != 0) { + result = Qnil; + /* 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) { - result = Qnil; - state = 0; + state = TAG_NONE; if (r_proc) { result = (*r_proc) (data2, ec->errinfo); } -- cgit v1.2.3