diff options
-rw-r--r-- | op.c | 1 | ||||
-rw-r--r-- | t/run/locale.t | 15 |
2 files changed, 15 insertions, 1 deletions
@@ -2606,6 +2606,7 @@ S_fold_constants(pTHX_ register OP *o) case OP_SLE: case OP_SGE: case OP_SCMP: + case OP_SPRINTF: /* XXX what about the numeric ops? */ if (PL_hints & HINT_LOCALE) goto nope; diff --git a/t/run/locale.t b/t/run/locale.t index 483123f16b..2f7306b521 100644 --- a/t/run/locale.t +++ b/t/run/locale.t @@ -128,6 +128,19 @@ EOF "too late to ignore the locale at write() time"); } } + + for ($different) { + local $ENV{LC_NUMERIC} = $_; + local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC + fresh_perl_is(<<'EOF', "$difference "x4, {}, + use locale; + use POSIX qw(locale_h); + setlocale(LC_NUMERIC, ""); + my $in = 4.2; + printf("%g %g %s %s ", $in, 4.2, sprintf("%g", $in), sprintf("%g", 4.2)); +EOF + "sprintf() and printf() look at LC_NUMERIC regardless of constant folding"); + } } # SKIP -sub last { 6 } +sub last { 7 } |