This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: pmdynflags and thread safety
[perl5.git] / pad.c
diff --git a/pad.c b/pad.c
index f565ce2..8560d9a 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1619,7 +1619,10 @@ Perl_pad_push(pTHX_ PADLIST *padlist, int depth)
        for ( ;ix > 0; ix--) {
            if (names_fill >= ix && names[ix] != &PL_sv_undef) {
                const char sigil = SvPVX_const(names[ix])[0];
-               if ((SvFLAGS(names[ix]) & SVf_FAKE) || sigil == '&') {
+               if ((SvFLAGS(names[ix]) & SVf_FAKE)
+                       || (SvFLAGS(names[ix]) & SVpad_STATE)
+                       || sigil == '&')
+               {
                    /* outer lexical or anon code */
                    av_store(newpad, ix, SvREFCNT_inc(oldpad[ix]));
                }