summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2008-01-09 01:50:38 +0000
committerDave Mitchell <davem@fdisolutions.com>2008-01-09 01:50:38 +0000
commit33894c1aa3e715f48f9d6f591dc779d058e6329b (patch)
tree0ce1474cb8c46466988d185abbf29b26105038b7 /pad.c
parent1f0bbb56807074c4a1da6fa28c421d1070fd4fff (diff)
downloadperl-33894c1aa3e715f48f9d6f591dc779d058e6329b.tar.gz
change #31447 was wrong. Really handle cloning a stale lexical var
p4raw-link: @31447 on //depot/perl: efa785391fea9e6aff4c999b27ad62b7d8f9ea99 p4raw-id: //depot/perl@32906
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pad.c b/pad.c
index 6e33495fcb..cfd3787eb1 100644
--- a/pad.c
+++ b/pad.c
@@ -1494,17 +1494,17 @@ Perl_cv_clone(pTHX_ CV *proto)
if (SvFAKE(namesv)) { /* lexical from outside? */
sv = outpad[PARENT_PAD_INDEX(namesv)];
assert(sv);
- /* formats may have an inactive parent */
- if (SvTYPE(proto) == SVt_PVFM && SvPADSTALE(sv)) {
+ /* formats may have an inactive parent,
+ while my $x if $false can leave an active var marked as
+ stale */
+ if (SvPADSTALE(sv)) {
if (ckWARN(WARN_CLOSURE))
Perl_warner(aTHX_ packWARN(WARN_CLOSURE),
"Variable \"%s\" is not available", SvPVX_const(namesv));
sv = NULL;
}
- /* 'my $x if $y' can leave $x stale even in an active sub */
- else if (!SvPADSTALE(sv)) {
+ else
SvREFCNT_inc_simple_void_NN(sv);
- }
}
if (!sv) {
const char sigil = SvPVX_const(namesv)[0];