Copy va_list of exception classes
The list is reused when an exception raised again after retrying in the rescue procedure.
This commit is contained in:
parent
a6f5f3cccd
commit
97cf290063
Notes:
git
2021-02-09 12:59:38 +09:00
6
eval.c
6
eval.c
@ -1033,14 +1033,18 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1,
|
|||||||
if (state == TAG_RAISE) {
|
if (state == TAG_RAISE) {
|
||||||
int handle = FALSE;
|
int handle = FALSE;
|
||||||
VALUE eclass;
|
VALUE eclass;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
result = Qnil;
|
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)) {
|
if (rb_obj_is_kind_of(ec->errinfo, eclass)) {
|
||||||
handle = TRUE;
|
handle = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
state = TAG_NONE;
|
state = TAG_NONE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user