Commit c6f5d9c430 for perl

commit c6f5d9c430515aec496de44f3abe2de8ebae26ca
Author: Karl Williamson <khw@cpan.org>
Date:   Thu Sep 24 08:53:56 2026 -0600

    Fallback to C locale early in initialization process

    This only showed up when emulating thread-safe locales, and apparently
    only on systems where LC_ALL is represented by a positional notation.
    This situation requires extra setup, and so use "C" if it is so early in
    the process that the data isn't yet available.

diff --git a/locale.c b/locale.c
index 979fc8d002..8a7268db2c 100644
--- a/locale.c
+++ b/locale.c
@@ -2333,7 +2333,14 @@ Perl_category_lock(pTHX_ const UV mask,

 #  endif

-        assert(wanted);
+        /* On some platforms, notably those where the LC_ALL uses positional
+         * notation, this function can get called during set-up before the
+         * above variables are populated.  In that case, just use "C", as that
+         * should be the only legitimate locale this early on */
+        if (! wanted) {
+            assert(PL_phase == PERL_PHASE_CONSTRUCT);
+            wanted = "C";
+        }

         DEBUG_Lv(PerlIO_printf(Perl_debug_log,
                                "%s: wanted=%s\n",