RT #130385
Technically
sv = &PL_sv_undef;
....
sv_set_undef(sv)
is modifying a read-only variable and so should croak, but some XS code
relies on the behaviour previous to the introduction of sv_set_undef(),
where:
sv = &PL_sv_undef;
....
sv_setsv(sv, &PL_undef)
silently succeeds (sv_setsv() returns immediately if src and dst
addresses are the same).
if (type <= SVt_IV) {
assert(!SvGMAGICAL(sv));
- if (SvREADONLY(sv))
+ if (SvREADONLY(sv)) {
+ /* does undeffing PL_sv_undef count as modifying a read-only
+ * variable? Some XS code does this */
+ if (sv == &PL_sv_undef)
+ return;
Perl_croak_no_modify();
+ }
if (SvROK(sv)) {
if (SvWEAKREF(sv))