Commit 305b682460 for perl
commit 305b682460dd0ad6310d0d7cfd7387b593c1085c
Author: Karl Williamson <khw@cpan.org>
Date: Thu Sep 24 09:08:28 2026 -0600
Reapply "Temporarily enable thread-safe locale emulation"
This reverts commit 098735fed6bf5f779f5900473a32a8fce21435cd.
The two commits just prior to this one fix the bugs which led to the
reversion.
diff --git a/embed.h b/embed.h
index 81798b9f46..8c9bcacc11 100644
--- a/embed.h
+++ b/embed.h
@@ -31,6 +31,7 @@
# undef CC_MAGICAL_
# undef CC_UNDERSCORE_
# undef do_aexec
+# undef EMULATE_THREAD_SAFE_LOCALES
# undef F_atan2_amg
# undef F_cos_amg
# undef F_exp_amg
diff --git a/perl.h b/perl.h
index 99ee06c35e..78defa0544 100644
--- a/perl.h
+++ b/perl.h
@@ -1543,6 +1543,11 @@ typedef enum {
# if defined(USE_POSIX_2008_LOCALE) \
|| (defined(WIN32) && (defined(_MSC_VER) || (defined(_UCRT))))
# define USE_THREAD_SAFE_LOCALE
+# endif
+
+ /* Temporary during 5.45 development to find any bugs */
+# if ! defined(USE_THREAD_SAFE_LOCALE) && ! defined(NO_EMULATE_THREAD_SAFE_LOCALES)
+# define EMULATE_THREAD_SAFE_LOCALES
# endif
# endif
@@ -5780,6 +5785,9 @@ EXTERN_C char **environ; /* environment variables supplied via exec */
#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_REVISION) "." \
STRINGIFY(PERL_API_VERSION) "." \
STRINGIFY(PERL_API_SUBVERSION)
+#if PERL_VERSION_GE(5,45,9)
+# error Revert the commit that created this line
+#endif
START_EXTERN_C
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 17d4c9b128..0c706ce271 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -352,6 +352,32 @@ well.
=item *
+During regex compilation, C<S_reg> will attempt to flatten nested BRANCH
+structures, in an attempt to give the TRIE optimizer more alternations
+to consider. The intent is that patterns that were previously compiled
+into two or more adjacent TRIE nodes might now get compiled into a single
+(or at least, fewer) TRIE node(s).
+
+=item *
+
+Locale thread-safety is now enabled by default for the next few v5.45
+development releases.
+
+This feature, introduced with default-off in v5.45.3, is never turned on
+for builds that don't have threads, and on platforms where perl believes
+that the locale handling is natively thread-safe.
+
+Otherwise, the feature is on by default during a portion of the
+remaining 5.45 development cycle, so as to test it in the field, but the
+intention is to make it opt-in for the official 5.46 release. To turn
+it off, pass this to F<Configure>:
+
+ -Accflags=-DNO_EMULATE_THREAD_SAFE_LOCALES
+
+See L<perllocale/Multi-threaded operation>.
+
+=item *
+
XXX
=back
diff --git a/pod/perllocale.pod b/pod/perllocale.pod
index 4e324291f4..2b55742621 100644
--- a/pod/perllocale.pod
+++ b/pod/perllocale.pod
@@ -542,7 +542,14 @@ Perl avoids their use.
However, beginning in Perl 5.46, Perl may be Configured to emulate
thread-safe operations on any system lacking native thread-safe locales.
This will decrease performance, so you may want to experiment if the
-amount of that decrease is acceptable for your needs. To enable this,
+amount of that decrease is acceptable for your needs. During a portion
+of the 5.45 development cycle, the feature is by default enabled so as
+to actually field test it. To turn it off, add to the Configure call
+the option
+
+ -Accflags=-DNO_EMULATE_THREAD_SAFE_LOCALES
+
+To enable this feature on Perl versions where the default is not enabled,
add to the Configure call the option
-Accflags=-DEMULATE_THREAD_SAFE_LOCALES