This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Fix dangling set of LC_NUMERIC to C
authorKarl Williamson <khw@cpan.org>
Fri, 23 Feb 2018 18:06:45 +0000 (11:06 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 25 Feb 2018 05:08:41 +0000 (22:08 -0700)
In the past, we've kept LC_NUMERIC in the C locale, because so much code
relies on the radix character being a dot.  5.27.9 added an enhancement
that checks if the current locale already has it be a dot.  If so, it's
fine to keep the locale in that one.

The spot fixed by this commit didn't get updated to account for this
change.

(I realize that the docs also need to be updated; that will be in a
future commit)

locale.c

index 32a423f..149cdb1 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1354,7 +1354,12 @@ S_new_numeric(pTHX_ const char *newnum)
     /* Keep LC_NUMERIC in the C locale.  This is for XS modules, so they don't
      * have to worry about the radix being a non-dot.  (Core operations that
      * need the underlying locale change to it temporarily). */
-    set_numeric_standard();
+    if (PL_numeric_standard) {
+        set_numeric_radix(0);
+    }
+    else {
+        set_numeric_standard();
+    }
 
 #endif /* USE_LOCALE_NUMERIC */