diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-10 13:06:26 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-11 07:41:27 -0700 |
commit | c13d5d105bb279112ad400ff1b19adfdc70c80ac (patch) | |
tree | 812219cbb29c0fd48d5b4f11503d5214e0fd2f19 /t/op/bless.t | |
parent | 5a37a95f0f47817e59d3f5f9e96f98b4e0cde07e (diff) | |
download | perl-c13d5d105bb279112ad400ff1b19adfdc70c80ac.tar.gz |
Don’t allow read-only COWs to be blessed
The logic exempting copy-on-write scalars from read-only checks in
sv_bless was left over from when READONLY+FAKE meant copy-on-write.
Diffstat (limited to 't/op/bless.t')
-rw-r--r-- | t/op/bless.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/op/bless.t b/t/op/bless.t index 801e9858b3..9d393264a1 100644 --- a/t/op/bless.t +++ b/t/op/bless.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan (110); +plan (111); sub expected { my($object, $package, $type) = @_; @@ -148,3 +148,9 @@ delete $::{"_117941::"}; eval { _117941() }; like $@, qr/^Attempt to bless into a freed package at /, 'bless with one arg when current stash is freed'; + +for(__PACKAGE__) { + eval { bless \$_ }; + like $@, qr/^Modification of a read-only value attempted/, + 'read-only COWs cannot be blessed'; +} |