-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exception in DESTROY in global destruction is “swallowed” confusingly #18063
Labels
Comments
Note that in perl5.22.4 the output is different
|
The behavior was changed in v5.25.3 by 8c86f02 |
Here is a suggestion to restore the previous behavior only during global destruction diff --git a/pp_ctl.c b/pp_ctl.c
index 5a66e267a7..ffb0506f47 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1654,7 +1654,11 @@ Perl_die_unwind(pTHX_ SV *msv)
if (in_eval) {
I32 cxix;
- exceptsv = sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv));
+ if (PL_phase == PERL_PHASE_DESTRUCT) {
+ exceptsv = sv_mortalcopy(exceptsv);
+ } else {
+ exceptsv = sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv));
+ }
/*
* Historically, perl used to set ERRSV ($@) early in the die |
atoomic
added a commit
to atoomic/perl5
that referenced
this issue
Aug 14, 2020
Fix Perl#18063 During global destruction make sure we preserve the string by using mortalcopy. This is an update on 8c86f02 change which avoided sv_mortalcopy in favor of sv_2mortal.
atoomic
added a commit
to atoomic/perl5
that referenced
this issue
Aug 14, 2020
Fix Perl#18063 During global destruction make sure we preserve the string by using mortalcopy. This is an update on 8c86f02 change which avoided sv_mortalcopy in favor of sv_2mortal.
atoomic
added a commit
to atoomic/perl5
that referenced
this issue
Mar 30, 2022
Fix Perl#18063 During global destruction make sure we preserve the string by using mortalcopy. This is an update on 8c86f02 change which avoided sv_mortalcopy in favor of sv_2mortal. (cherry picked from commit 042abef) Signed-off-by: ℕicolas ℝochelemagne <rochelemagne@cpanel.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module: core
Description
gives:
Expected behavior
Ideally
nono
should print to STDERR. At the very minimum, though, it seems confusing that(in cleanup)
shows twice and makes it look like something confused perl.Perl configuration
5.30.0, 5.26.3
The text was updated successfully, but these errors were encountered: