set_sv_to_null_pdl#

set_sv_to_null_pdl($sv) — connect an existing SV to a freshly-allocated empty pdl. Mirrors Core.xs:1073-1082pdlcore.c:34 pdl_SetSV_PDL.

Storable’s thaw path receives a blessed-scalar-ref stub from Storable core and needs to reshape it into a real PDL object. Upstream (Core.xs:1077-1082):

pdl *it = pdl_pdlnew();
sv_setiv(SvRV(sv), PTR2IV(it));   // inner becomes PTR-IV
it->sv = SvRV(sv);                 // link back
pdl_SetSV_PDL(sv, it);             // inner has it->sv set, so
                                   // pdl_SetSV_PDL takes the
                                   // `else` branch: create a
                                   // new RV pointing at it->sv,
                                   // SvAMAGIC_on it,
                                   // sv_setsv(sv, newref),
                                   // SvREFCNT_dec(newref).