summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorChristian Kirsch <ck@held.mind.de>2000-08-09 19:05:17 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-16 13:03:53 +0000
commitf93f4e4670f12de7577ebaebeb5e31d4510ff4fe (patch)
tree10619fb7889a8bcdaed40144c803c17fa0fa25ec /dump.c
parenta65e9df7d11c78917193138b8249299b47efd8b4 (diff)
downloadperl-f93f4e4670f12de7577ebaebeb5e31d4510ff4fe.tar.gz
The numeric locale was reset to "C" by s?printf and never restored.
Subject: [ID 20000809.003] setlocale(LC_NUMERIC...) produces different results in 5.005 and 5.6 Message-Id: <20000809170517.A25389@held> No test since adding the failing example to locale.t does not fail -- probably because the locale settings are so thoroughly tweaked by that time. Running the example standalone does fail, though. UPDATE: test case added at change #7540. p4raw-link: @7540 (not found) p4raw-id: //depot/perl@6648
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dump.c b/dump.c
index 1570a91ce0..d0190f58f8 100644
--- a/dump.c
+++ b/dump.c
@@ -279,9 +279,12 @@ Perl_sv_peek(pTHX_ SV *sv)
}
}
else if (SvNOKp(sv)) {
- RESTORE_NUMERIC_STANDARD();
+ bool was_local = PL_numeric_local;
+ if (!was_local)
+ SET_NUMERIC_STANDARD();
Perl_sv_catpvf(aTHX_ t, "(%g)",SvNVX(sv));
- RESTORE_NUMERIC_LOCAL();
+ if (was_local)
+ SET_NUMERIC_LOCAL();
}
else if (SvIOKp(sv)) {
if (SvIsUV(sv))
@@ -929,14 +932,17 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
PerlIO_putc(file, '\n');
}
if (type >= SVt_PVNV || type == SVt_NV) {
- RESTORE_NUMERIC_STANDARD();
+ bool was_local = PL_numeric_local;
+ if (!was_local)
+ SET_NUMERIC_STANDARD();
/* %Vg doesn't work? --jhi */
#ifdef USE_LONG_DOUBLE
Perl_dump_indent(aTHX_ level, file, " NV = %.*" PERL_PRIgldbl "\n", LDBL_DIG, SvNVX(sv));
#else
Perl_dump_indent(aTHX_ level, file, " NV = %.*g\n", DBL_DIG, SvNVX(sv));
#endif
- RESTORE_NUMERIC_LOCAL();
+ if (was_local)
+ SET_NUMERIC_LOCAL();
}
if (SvROK(sv)) {
Perl_dump_indent(aTHX_ level, file, " RV = 0x%"UVxf"\n", PTR2UV(SvRV(sv)));