This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct the IO::Select version in perldelta
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index 447d86c..1ac7e31 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -286,7 +286,7 @@ Perl_mg_set(pTHX_ SV *sv)
            mg->mg_flags &= ~MGf_GSKIP; /* setting requires another read */
            (SSPTR(mgs_ix, MGS*))->mgs_magical = 0;
        }
-       if (PL_localizing == 2 && !S_is_container_magic(mg))
+       if (PL_localizing == 2 && (!S_is_container_magic(mg) || sv == DEFSV))
            continue;
        if (vtbl && vtbl->svt_set)
            vtbl->svt_set(aTHX_ sv, mg);
@@ -511,6 +511,9 @@ Perl_mg_localize(pTHX_ SV *sv, SV *nsv, bool setmagic)
 
     PERL_ARGS_ASSERT_MG_LOCALIZE;
 
+    if (nsv == DEFSV)
+       return;
+
     for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
        const MGVTBL* const vtbl = mg->mg_virtual;
        if (!S_is_container_magic(mg))
@@ -3028,12 +3031,14 @@ Perl_sighandler(int sig)
                exit(sig);
        }
 
-    /* Max number of items pushed there is 3*n or 4. We cannot fix
-       infinity, so we fix 4 (in fact 5): */
-    if (PL_savestack_ix + 15 <= PL_savestack_max) {
-       flags |= 1;
-       PL_savestack_ix += 5;           /* Protect save in progress. */
-       SAVEDESTRUCTOR_X(S_unwind_handler_stack, NULL);
+    if (PL_signals &  PERL_SIGNALS_UNSAFE_FLAG) {
+       /* Max number of items pushed there is 3*n or 4. We cannot fix
+          infinity, so we fix 4 (in fact 5): */
+       if (PL_savestack_ix + 15 <= PL_savestack_max) {
+           flags |= 1;
+           PL_savestack_ix += 5;               /* Protect save in progress. */
+           SAVEDESTRUCTOR_X(S_unwind_handler_stack, NULL);
+       }
     }
     /* sv_2cv is too complicated, try a simpler variant first: */
     if (!SvROK(PL_psig_ptr[sig]) || !(cv = MUTABLE_CV(SvRV(PL_psig_ptr[sig])))
@@ -3057,9 +3062,11 @@ Perl_sighandler(int sig)
     flags |= 8;
     SAVEFREESV(sv);
 
-    /* make sure our assumption about the size of the SAVEs are correct:
-     * 3 for SAVEDESTRUCTOR_X, 2 for SAVEFREESV */
-    assert(old_ss_ix + 2 + ((flags & 1) ? 3+5 : 0)  == PL_savestack_ix);
+    if (PL_signals &  PERL_SIGNALS_UNSAFE_FLAG) {
+       /* make sure our assumption about the size of the SAVEs are correct:
+        * 3 for SAVEDESTRUCTOR_X, 2 for SAVEFREESV */
+       assert(old_ss_ix + 2 + ((flags & 1) ? 3+5 : 0)  == PL_savestack_ix);
+    }
 
     PUSHSTACKi(PERLSI_SIGNAL);
     PUSHMARK(SP);