summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-28 13:19:33 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-07-28 13:19:33 -0700
commitba36554e02872e48d146177a57a9cfb154727fae (patch)
tree4b9877f12763e5fe851a174299b625a6c834fc65 /op.c
parentf99a5f08f203af84430e677e25df49557c55c24f (diff)
downloadperl-ba36554e02872e48d146177a57a9cfb154727fae.tar.gz
[perl #119043] Exempt shared hash key consts from ro
Commit 19130678b4 stopped copy-on-write scalars from being exempt from readonliness in ck_svconst (called for every OP_CONST). That was for the sake of consistency. It turns out this breaks CPAN modules, so change it back, but only for shared hash key scalars, not other COW scalars. This is an historical artefact left over from when copy-on-write used the read-only flag without the scalar actually being read-only.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index 7576509639..9ae081213f 100644
--- a/op.c
+++ b/op.c
@@ -10568,7 +10568,9 @@ Perl_ck_svconst(pTHX_ OP *o)
{
PERL_ARGS_ASSERT_CK_SVCONST;
PERL_UNUSED_CONTEXT;
- SvREADONLY_on(cSVOPo->op_sv);
+ /* For historical reasons, shared hash scalars are not made read-only.
+ */
+ if (!SvIsCOW_shared_hash(cSVOPo->op_sv)) SvREADONLY_on(cSVOPo->op_sv);
return o;
}