diff options
-rw-r--r-- | gv.c | 3 | ||||
-rw-r--r-- | t/op/gv.t | 6 |
2 files changed, 7 insertions, 2 deletions
@@ -3320,7 +3320,8 @@ Perl_gv_try_downgrade(pTHX_ GV *gv) !GvSV(gv) && !GvAV(gv) && !GvHV(gv) && !GvIOp(gv) && !GvFORM(gv) && GvEGVx(gv) == gv && (stash = GvSTASH(gv)))) return; - if (gv == PL_statgv || gv == PL_stderrgv) return; + if (gv == PL_statgv || gv == PL_last_in_gv || gv == PL_stderrgv) + return; if (SvMAGICAL(gv)) { MAGIC *mg; /* only backref magic is allowed */ @@ -12,7 +12,7 @@ BEGIN { use warnings; -plan( tests => 256 ); +plan( tests => 257 ); # type coercion on assignment $foo = 'foo'; @@ -986,6 +986,10 @@ package lrcg { -T _; is "$!",$bang, 'try_downgrade does not touch PL_statgv (last stat handle)'; + readline *{"try_downgrade2"}; + my $lastfh = "${^LAST_FH}"; + eval "*try_downgrade2 if 0"; + is ${^LAST_FH}, $lastfh, 'try_downgrade does not touch PL_last_in_gv'; } is runperl(prog => '$s = STDERR; close $s; undef *$s;' |