This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv.c: Allow blessed cows
authorFather Chrysostomos <sprout@cpan.org>
Sun, 28 Oct 2012 06:53:46 +0000 (23:53 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 28 Oct 2012 09:04:58 +0000 (02:04 -0700)
There is no reason kine should not receive blessings, too.

sv.c

diff --git a/sv.c b/sv.c
index 660642f..7f40cc7 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -9446,9 +9446,7 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
         Perl_croak(aTHX_ "Can't bless non-reference value");
     tmpRef = SvRV(sv);
     if (SvFLAGS(tmpRef) & (SVs_OBJECT|SVf_READONLY)) {
-       if (SvIsCOW(tmpRef))
-           sv_force_normal_flags(tmpRef, 0);
-       if (SvREADONLY(tmpRef))
+       if (SvREADONLY(tmpRef) && !SvIsCOW(tmpRef))
            Perl_croak_no_modify(aTHX);
        if (SvOBJECT(tmpRef)) {
            if (SvTYPE(tmpRef) != SVt_PVIO)