summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-03-03 17:35:47 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-03-03 19:40:48 +0900
commit70e9489f9ea85ddaa68fb43398c14a3921cacb27 (patch)
tree57289089a4bf39bf5b24920e055a312390a8757d /eval.c
parentdb21768950323dbaa0bbd86186da6fd69ae65ce3 (diff)
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(-)
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 8 insertions, 4 deletions
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);
}