--- JSON-XS/XS.xs 2010/08/17 23:27:36 1.108 +++ JSON-XS/XS.xs 2011/06/01 13:01:09 1.110 @@ -262,6 +262,7 @@ // this relies greatly on the quality of the pow () // implementation of the platform, but a good // implementation is hard to beat. + // (IEEE 754 conformant ones are required to be exact) if (postdp) *expo -= eaccum; *accum += uaccum * Perl_pow (10., *expo); *expo += eaccum; @@ -1522,10 +1523,12 @@ SV *sv; /* work around bugs in 5.10 where manipulating magic values - * will perl ignore the magic in subsequent accesses + * will perl ignore the magic in subsequent accesses. + * also make a copy of non-PV values, to get them into a clean + * state (SvPV should do that, but it's buggy, see below). */ /*SvGETMAGIC (string);*/ - if (SvMAGICAL (string)) + if (SvMAGICAL (string) || !SvPOK (string)) string = sv_2mortal (newSVsv (string)); SvUPGRADE (string, SVt_PV);