From f91073d438e1f6952add377836e416c47505261f Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 4 Aug 2012 17:54:32 -0700 Subject: [PATCH] pad.c:cv_clone: add assertions The outer sub should always be active and have a pad if it is a sub that is being cloned. Only formats can have an inactive or padless outside. Add assertions to that effect. --- pad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pad.c b/pad.c index 1e796e7..8deae8e 100644 --- a/pad.c +++ b/pad.c @@ -2010,6 +2010,7 @@ Perl_cv_clone(pTHX_ CV *proto) outpad = CvPADLIST(outside) ? AvARRAY(AvARRAY(CvPADLIST(outside))[depth]) : NULL; + assert(outpad || SvTYPE(cv) == SVt_PVFM); for (ix = fpad; ix > 0; ix--) { SV* const namesv = (ix <= fname) ? pname[ix] : NULL; @@ -2022,6 +2023,7 @@ Perl_cv_clone(pTHX_ CV *proto) if (!outpad || !(sv = outpad[PARENT_PAD_INDEX(namesv)]) || ( SvPADSTALE(sv) && !SvPAD_STATE(namesv) && !CvDEPTH(outside)) ) { + assert(SvTYPE(cv) == SVt_PVFM); Perl_ck_warner(aTHX_ packWARN(WARN_CLOSURE), "Variable \"%"SVf"\" is not available", namesv); sv = NULL; -- 1.8.3.1