SvIsCOW was ignoring the fact that it might be passed a
typeglob, which made its behaviour contradict its docs.
This fixes that and, in doing so, simplifies the
upcoming Internals::SvREADONLY fix.
ext/XS-APItest/t/stmtsasexpr.t test recursive descent statement-sequence parsing
ext/XS-APItest/t/stuff_modify_bug.t test for eval side-effecting source string
ext/XS-APItest/t/stuff_svcur_bug.t test for a bug in lex_stuff_pvn
+ext/XS-APItest/t/sviscow.t Test SvIsCOW
ext/XS-APItest/t/svpeek.t XS::APItest extension
ext/XS-APItest/t/svpv_magic.t Test behaviour of SvPVbyte and get magic
ext/XS-APItest/t/svsetsv.t Test behaviour of sv_setsv with/without PERL_CORE
HeVAL(entry) = NULL;
}
+bool
+SvIsCOW(SV *sv)
+CODE:
+ RETVAL = SvIsCOW(sv);
+OUTPUT:
+ RETVAL
+
MODULE = XS::APItest PACKAGE = XS::APItest::Magic
PROTOTYPES: DISABLE
--- /dev/null
+use strict;
+use warnings; no warnings 'once';
+
+use Test::More tests => 1;
+
+use XS::APItest;
+use Hash::Util 'lock_value';
+
+my %h;
+$h{g} = *foo;
+lock_value %h, 'g';
+
+ok(!SvIsCOW($h{g}), 'SvIsCOW is honest when it comes to globs');
# define SvTRUEx(sv) ((PL_Sv = (sv)), SvTRUE(PL_Sv))
#endif /* __GNU__ */
-#define SvIsCOW(sv) ((SvFLAGS(sv) & (SVf_FAKE | SVf_READONLY)) == \
- (SVf_FAKE | SVf_READONLY))
+#define SvIsCOW(sv) ((SvFLAGS(sv) & (SVf_FAKE | SVf_READONLY)) == \
+ (SVf_FAKE | SVf_READONLY) && !isGV_with_GP(sv))
#define SvIsCOW_shared_hash(sv) (SvIsCOW(sv) && SvLEN(sv) == 0)
#define SvSHARED_HEK_FROM_PV(pvx) \