This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/loc_tools.pl: Don't test unsafe locales
authorKarl Williamson <khw@cpan.org>
Sun, 14 Jun 2020 14:10:35 +0000 (08:10 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 18 Jul 2020 04:04:08 +0000 (22:04 -0600)
Under threads, locales may or may not be safe to use.  Skip the testing
of them when unsafe.

t/loc_tools.pl

index 5d11d06..1f8a8df 100644 (file)
@@ -215,6 +215,10 @@ sub locales_enabled(;$) {
     # normally would be available
     return 0 if ! defined &DynaLoader::boot_DynaLoader;
 
+    # Don't test locales where they aren't safe.
+    return 0 unless  ${^SAFE_LOCALES};
+
+    # If no setlocale, we need the POSIX 2008 alternatives
     if (! $Config{d_setlocale}) {
         return 0 if $Config{ccflags} =~ /\bD?NO_POSIX_2008_LOCALE\b/;
         return 0 unless $Config{d_newlocale};