From f2047bf1d09481734b45bedab1675f6f7b8d6de1 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 24 Aug 2013 05:54:23 -0700 Subject: =?UTF-8?q?Don=E2=80=99t=20give=20unavailability=20warnings=20abou?= =?UTF-8?q?t=20our=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit ce0d59fdd1c started using NULL to indicate nonexistent array elements. Since pads are AVs, they are filled with NULLs initially, rather than &PL_sv_undef. For ‘our’ vars, the pad entry is never actually touched. Only one piece of code was inspecting it, namely S_cv_clone_pad. &PL_sv_undef just happens to pass the checks that make sure the var is not stale. However, we really should not be checking that at all if this is an ‘our’ var. Even if we change ‘our’ vars back to having a &PL_sv_undef pad entry, this fix should stay, as it makes the code clearer and makes S_cv_clone_pad more robust. --- pad.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pad.c') diff --git a/pad.c b/pad.c index 92765f0f79..a034d09227 100644 --- a/pad.c +++ b/pad.c @@ -2073,6 +2073,10 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv) SV* const namesv = (ix <= fname) ? pname[ix] : NULL; SV *sv = NULL; if (namesv && PadnameLEN(namesv)) { /* lexical */ + if (PadnameIsOUR(namesv)) { /* or maybe not so lexical */ + NOOP; + } + else { if (SvFAKE(namesv)) { /* lexical from outside? */ /* formats may have an inactive, or even undefined, parent; but state vars are always available. */ @@ -2126,6 +2130,7 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv) if (sigil != '&' && SvPAD_STATE(namesv)) SvPADSTALE_on(sv); } + } } else if (IS_PADGV(ppad[ix]) || (namesv && PadnamePV(namesv))) { sv = SvREFCNT_inc_NN(ppad[ix]); -- cgit v1.2.1