diff options
author | Graham Knop <haarg@haarg.org> | 2022-03-15 15:19:03 +0100 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2022-03-15 15:44:55 +0000 |
commit | b1e3ba27cdcf1b4e2558f05ed4cc6780d2f208e1 (patch) | |
tree | 81b3be34b81b144dbe4100e4a22ea693cf8f88f3 /sv.c | |
parent | fa5eb2fe191f21f418d0f6a6496145294272ad9d (diff) | |
download | perl-b1e3ba27cdcf1b4e2558f05ed4cc6780d2f208e1.tar.gz |
always prevent setting POK flag when NV values are used as strings
Since PR #18958, values that start as IVs will not get their POK flags
set when they are used as strings. This is meant to aid in
serialization, allowing the "original" type of a value to be preserved.
For NV values, the POK flag was already usually not being set, because
the string form of a float could change based on the locale changing.
However, for Inf and NaN values, the POK flag would still be enabled.
Also, POK would be set for all floats if USE_LOCALE_NUMERIC was not
defined.
Update Perl_sv_2pv_flags to only enable the POKp flag when storing the
PV for Inf or NaN values, or all NVs when USE_LOCALE_NUMERIC is not
defined.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3005,7 +3005,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const U32 flags) len = S_infnan_2pv(SvNVX(sv), s, size, 0); if (len > 0) { s += len; - SvPOK_on(sv); + SvPOKp_on(sv); } else { /* some Xenix systems wipe out errno here */ @@ -3025,7 +3025,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const U32 flags) #ifndef USE_LOCALE_NUMERIC SNPRINTF_G(SvNVX(sv), s, SvLEN(sv), NV_DIG); - SvPOK_on(sv); + SvPOKp_on(sv); #else { bool local_radix; |