diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t index 53f1c8b2d360..d6f1f21e68a5 100644 --- a/ext/Devel-Peek/t/Peek.t +++ b/ext/Devel-Peek/t/Peek.t @@ -534,7 +534,7 @@ do_test('string with Unicode', . '"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\] CUR = 5 LEN = \\d+ - COW_REFCNT = 1 # $] < 5.019007 + COW_REFCNT = 1 # $] < 5.019007 || $] >=5.041000 '); do_test('reference to hash containing Unicode', @@ -558,7 +558,7 @@ do_test('reference to hash containing Unicode', PV = $ADDR "' . $cp200_bytes . '"\\\0 \[UTF8 "\\\x\{200\}"\] CUR = 2 LEN = \\d+ - COW_REFCNT = 1 # $] < 5.019007 + COW_REFCNT = 1 # $] < 5.019007 || $] >=5.041000 ', '', $] >= 5.015 ? undef diff --git a/op.c b/op.c index 3fc23eca49af..cd1b07017e5a 100644 --- a/op.c +++ b/op.c @@ -5081,7 +5081,9 @@ S_fold_constants(pTHX_ OP *const o) SvPADTMP_off(sv); else if (!SvIMMORTAL(sv)) { SvPADTMP_on(sv); - SvREADONLY_on(sv); + /* Do not set SvREADONLY(sv) here. newSVOP will call + * Perl_ck_svconst, which will do it. Setting it early + * here prevents Perl_ck_svconst from setting SvIsCOW(sv).*/ } newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv)); if (!is_stringify) newop->op_folded = 1; diff --git a/t/op/undef.t b/t/op/undef.t index cce5885b323e..fdba6f6771e1 100644 --- a/t/op/undef.t +++ b/t/op/undef.t @@ -165,7 +165,9 @@ SKIP: { my $out = runperl(stderr => 1, progs => [ split /\n/, <<'EOS' ]); require Devel::Peek; - my $f = q(x) x 40; $f = undef; + my $f = q(x) x 40; + chop $f; # Make sure that the PV buffer is not COWed + $f = undef; Devel::Peek::Dump($f); undef $f; Devel::Peek::Dump($f);