Skip to content

Commit 41f0846

Browse files
committed
Copy values that are "written as IV, then read as PV" with the same flags.
Previously Perl_sv_setsv_flags() would gleefully turn on SVf_POK for these values, which meant that any copy no longer propagated the (new) state that says "this value started as an integer".
1 parent 6dcc8e4 commit 41f0846

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4790,6 +4790,12 @@ Perl_sv_setsv_flags(pTHX_ SV *dsv, SV* ssv, const I32 flags)
47904790
SvIV_set(dsv, SvIVX(ssv));
47914791
if (sflags & SVf_IVisUV)
47924792
SvIsUV_on(dsv);
4793+
if ((sflags & SVf_IOK) && !(sflags & SVf_POK)) {
4794+
/* Source was SVf_IOK|SVp_IOK|SVp_POK but not SVf_POK, meaning
4795+
an value set as an integer and later stringified. So mark
4796+
destination the same: */
4797+
SvFLAGS(dsv) &= ~SVf_POK;
4798+
}
47934799
}
47944800
SvFLAGS(dsv) |= sflags & (SVf_IOK|SVp_IOK|SVf_NOK|SVp_NOK|SVf_UTF8);
47954801
{

0 commit comments

Comments
 (0)