diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-16 18:31:09 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-16 18:31:09 -0800 |
commit | 6dfba0aae8f42f8476fe450e6197024c9bd7a30e (patch) | |
tree | 805cfb9846aafd1c58ee0c44945cfc7291867690 /pad.c | |
parent | 82e85a9ce986972c02dda51b9fa63d84843ec468 (diff) | |
download | perl-6dfba0aae8f42f8476fe450e6197024c9bd7a30e.tar.gz |
Manually revert ‘Remove SvREADONLY_on from op.c:op_const_sv’
This effectively reverts d0a32af375ac806258a97cce0091ce4b3636f8dc.
It was wrong. And I should know that, too.
I was the one who implemented padtmp swiping and went around turning
on the read-only flag to make it work correctly.
This fails, because the second call to &$sub returns undef, its value
having been stolen by the $y assignment.
use Test::More tests=>1;
my $sub = sub {
my $x = "x"x2000; sub () {$x};
}->();
$y = &$sub;
$z = &$sub;
is $z, $y;
Diffstat (limited to 'pad.c')
-rw-r--r-- | pad.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2239,6 +2239,7 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv) /* If the lexical is not used elsewhere, it is safe to turn on SvPADTMP, since it is only when it is used in lvalue con- text that the difference is observable. */ + SvREADONLY_on(const_sv); SvPADTMP_on(const_sv); SvREFCNT_dec_NN(cv); cv = newCONSTSUB(CvSTASH(proto), NULL, const_sv); |