summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-04-23 02:22:54 +0100
committerZefram <zefram@fysh.org>2010-04-23 02:22:54 +0100
commit7ce092845b50544ac127e66e60d73a2f7b707464 (patch)
tree5cf5b6c0f2b75cb59669fd43c20c1c21b7ab5a66 /pp_ctl.c
parentc5df3096702d4a814b3774dff243e7eb74814257 (diff)
downloadperl-7ce092845b50544ac127e66e60d73a2f7b707464.tar.gz
bring G_KEEPERR back to the realm of sanity
Makes the G_KEEPERR logic more consistent, and in particular make it sensibly handle non-string exceptions. An exception in a destructor is now always emitted as a warning, and never copied or merged into $@ of the surrounding context. No more clobbering exceptions being handled elsewhere, and no more double reporting. This fixes the rest of [perl #74538].
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index f401fc7938..1be7b689b1 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1633,29 +1633,8 @@ Perl_die_unwind(pTHX_ SV *msv)
*msg ? msg : "Unknown error\n");
}
if (in_eval & EVAL_KEEPERR) {
- static const char prefix[] = "\t(in cleanup) ";
- SV * const err = ERRSV;
- const char *e = NULL;
- if (!SvPOK(err))
- sv_setpvs(err,"");
- else if (SvCUR(err) >= sizeof(prefix)+SvCUR(exceptsv)-1) {
- STRLEN len;
- STRLEN msglen;
- const char* message = SvPV_const(exceptsv, msglen);
- e = SvPV_const(err, len);
- e += len - msglen;
- if (*e != *message || strNE(e,message))
- e = NULL;
- }
- if (!e) {
- STRLEN start;
- SvGROW(err, SvCUR(err)+sizeof(prefix)+SvCUR(exceptsv));
- sv_catpvn(err, prefix, sizeof(prefix)-1);
- sv_catsv(err, exceptsv);
- start = SvCUR(err)-SvCUR(exceptsv)-sizeof(prefix)+1;
- Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "%s",
- SvPVX_const(err)+start);
- }
+ Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "\t(in cleanup) %s",
+ SvPV_nolen_const(exceptsv));
}
else {
sv_setsv(ERRSV, exceptsv);