diff options
author | Zefram <zefram@fysh.org> | 2010-04-23 02:22:54 +0100 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2010-04-23 02:22:54 +0100 |
commit | 7ce092845b50544ac127e66e60d73a2f7b707464 (patch) | |
tree | 5cf5b6c0f2b75cb59669fd43c20c1c21b7ab5a66 /pp_ctl.c | |
parent | c5df3096702d4a814b3774dff243e7eb74814257 (diff) | |
download | perl-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.c | 25 |
1 files changed, 2 insertions, 23 deletions
@@ -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); |